The UK ambassador to Iran was arrested during anti-government protests in Tehran after officials admitted shooting down a passenger plane.
Rob Macaire was held for three hours, in what the UK described as a "flagrant violation of international law".
It is understood he was attending a vigil for those who died in the crash, which turned into a protest.
He left to make his way back to the UK embassy, but was arrested as he stopped at a barber shop for a haircut.
In a statement, UK 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."
The Iranian Etemad newspaper shared a picture of the ambassador on Twitter after the Tasnim news agency reported his arrest.
Iranian media claimed Mr Macaire was accused of inciting anti-government protests.
Iran has said Ukraine International Airlines flight PS752 was shot down due to "human error" and there were demonstrations in Tehran and other cities on Saturday as people gathered to commemorate those who died.
Earlier, the UK prime minister said Iran's admission was an "important first step" and called for an investigation into the "tragic accident".
Missile strikes
Iran initially denied responsibility for Wednesday's crash - which killed 176 people, including four Britons.
But on Saturday, President Hassan Rouhani admitted Iranian military had "unintentionally" shot down the passenger plane after mistaking it for a cruise missile when it turned towards a sensitive military site.
President Rouhani said the missile strike was an "unforgivable mistake".
The crash came just hours after Iran carried out missile strikes on two airbases housing US forces in Iraq.
Mr Johnson said: "This will be an incredibly difficult time for all those families who lost loved ones in such tragic circumstances.
"We will do everything we can to support the families of the four British victims and ensure they get the answers and closure they deserve."
He said the investigation into the crash should be "comprehensive, transparent and independent", adding that he would work with other affected nations, including Canada and Ukraine.
The prime minister said it was "vital that all leaders now pursue a diplomatic way forward" in the conflict in the region.
"This tragic accident only reinforces the importance of de-escalating tensions in the region. We can all see very clearly that further conflict will only lead to more loss and tragedy," he said.
Writing in the Sunday Telegraph, Mr Raab said the missile strike on the Ukrainian plane marked "a moment where the regime in Tehran is at a crossroads".
"It is time for them to come to the negotiating table to resolve all of Iran's issues of international concern," he said.
Mr Raab said Iran "must stop pursuing a nuclear weapon, end its support for terrorism, and release the foreign nationals and dual nationals it cruelly holds".
The attack on the airliner came amid heightened tensions in the region following the killing of Iranian general Qasem Soleimani on 3 January.
Tehran vowed revenge after he died in a drone strike ordered by US President Donald Trump.
Labour leader Jeremy Corbyn said the shooting down of the passenger plane by Iran was "an appalling act, and part of a whole pattern of appalling acts all across the region".
"There's no excuse for shooting down an airliner, there's no excuse for a targeted assassination by one state against another," he said at an anti-war protest in central London on Saturday.
"All this does is set off a spiral of violence and danger which will lead us to yet more wars in the future."
'Devastating loss'
The Queen has also sent a message of condolence to the Governor-General of Canada - where the majority of the passengers on the flight were headed.
Out of the 176 victims on board the Kyiv-bound flight, 138 had listed Canada as their eventual destination.
The Queen said she and the Duke of Edinburgh were "deeply saddened by the tragic loss of life".
"Our thoughts and prayers are with the people of Canada, which has suffered such a devastating loss," she added.
"I extend my deepest condolences to the families, friends and colleagues of all those Canadians, and indeed other nationalities, who died, and to the many others who have been affected by this terrible event."
The Prince of Wales and the Duchess of Cornwall added their condolences, saying they were "utterly horrified" by the disaster.
"However hopelessly inadequate it may be, we particularly wanted you to know just how much our hearts go out to all those whose grief must be unbearable," they wrote to the Governor-General of Canada.
The UK government says that four Britons were on board the Ukrainian passenger plane.
Three have been named as Mohammed Reza Kadkhoda Zadeh, who owned a dry cleaners in West Sussex, BP engineer Sam Zokaei from Twickenham, and PhD student and engineer Saeed Tahmasebi, who lived in Dartford.
Mr Tahmasebi's Iranian wife, Niloufar Ebrahim, was also listed as a passenger on the plane.
Iran's ambassador to the UK, Hamid Baeidinejad, apologised for sharing "wrong findings" about the crash, having previously said he was "confident" that a missile had not been launched.
He expressed "regret" for giving a false statement to the media based on the official findings at the time.
Compiled by Olalekan Adeleye
BBC