The arrest came amid anti-government protests in Tehran over the missile blunder. Donald Trump warned Iran against "another massacre" of protesters.
Britain has condemned the arrest of its ambassador to Iran as "a flagrant violation of international law" after the diplomat was detained after attending a vigil for victims of the Ukraine International Airlines plane crash.
The UK Foreign & Commonwealth Office said in a statement that the ambassador, Rob Macaire, was released after a "brief detention."
Macaire tweeted that he had been "detained for half an hour" after leaving an event "advertised as a vigil for victims" of the crash after Iran admitted that it unintentionally shot down Ukraine International Airlines flight PS752, killing all 176 passengers and crew.
"Normal to want to pay respects- some of victims were British. I left after 5 mins, when some started chanting," Macaire tweeted.
"Arresting diplomats is, of course, illegal, in all countries," Macaire added.
British foreign secretary Dominic Raab said: "The arrest of our ambassador in Tehran without grounds or explanation is a flagrant violation of international law.
"The Iranian government is at a cross-roads moment. It can continue its march towards pariah status with all the political and economic isolation that entails, or take steps to deescalate tensions and engage in a diplomatic path forwards."
Iran's deputy foreign minister, Abbas Araghchi wrote on Twitter that Macaire was not detained but "arrested as [an] unknown foreigner in an illegal gathering."
Araghchi said that once he identified the ambassador, he was set free.
'There cannot be another massacre'
Crowds gathered on Saturday in at least four locations in Tehran, chanting 'death to liars' and calling for the country's supreme leader Ayatollah Ali Khamenei to step down over the missile blunder, according to local reporters.
Video shared on social media showed angry protests followed by police intervention and clouds of tear gas. None of the videos could be immediately verified by Euronews.
Posts to social media showed protesters take to the streets on Sunday as pressure mounted on the Iranian government to hold those responsible for shooting down the plane responsible. Riot police gathered in the capital expecting more protests, the Associated Press reported.
One Tehran resident told the AP she felt ashamed when she thought of the families of victims of the crash.
Later on Saturday, US President Donald Trump sent a message of solidarity to Iranian protesters by tweeting in English and Farsi.
"To the brave, long-suffering people of Iran: I've stood with you since the beginning of my Presidency, and my Administration will continue to stand with you," he tweeted. "We are following your protests closely, and are inspired by your courage.
"The government of Iran must allow human rights groups to monitor and report facts from the ground on the ongoing protests by the Iranian people. There can not be another massacre of peaceful protesters, nor an internet shutdown. The world is watching."