A top British official condemned Saturday’s arrest of the U.K. ambassador to Iran during anti-government protests in Tehran, calling the detainment “a flagrant violation of international law.”

Rob Macaire, who has been Britain’s envoy to the Islamic republic since March 2018, was arrested as he stopped at a barber shop for a haircut after attending a vigil for the victims of a Ukrainian jetliner that crashed in Tehran last week, the BBC reported.

Macaire left the vigil after it became a demonstration but was later accused by Iranian authorities of helping to incite the anti-government protest, The Independent of Britain reported.

TRUMP TWEETS SUPPORT OF IRANIAN ANTI-GOVERNMENT PROTESTERS AFTER UKRAINIAN PASSENGER PLANE SHOT DOWN

He was released after three hours but the arrest infuriated the British government.

"The arrest of our Ambassador in Tehran without grounds or explanation is a flagrant violation of international law,” British Foreign Secretary Dominic Raab said in a statement.

"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.”

A photo of Macaire was posted on Twitter by the Etemad newspaper of Iran after his arrest was reported by the Tasnim news agency, according to the BBC.

Tasnim tweeted that Macaire was detained “for organizing suspicious movements and protests in front of Amir Kabir University but released after hours.” The tweet added that Macaire would be “summoned by the foreign ministry tomorrow morning.”

In a Twitter message, U.S. State Department spokeswoman Morgan Ortagus called Macaire’s arrest a violation of the Vienna Convention, which she said the Iranian regime “has a notorious history of violating.”

“We call on the regime to formally apologize to the UK for violating his rights and to respect the rights of all diplomats,” Ortagus wrote.

Saturday’s anti-government protests in Tehran followed Iran’s admission Friday that its military had “unintentionally” shot down a Ukrainian passenger jet last week, killing all 176 people on board.

CLICK HERE TO GET THE FOX NEWS APP

Both Iranian President Hassan Rouhani and Foreign Minister Mohammad Javad Zarif attributed the downing of the jet to “human error” – but the foreign minister added that the error had been caused by “U.S. adventurism” – a likely reference to the American airstrike that killed Iranian Gen. Qassem Soleimani in Baghdad on Jan. 3.

On Saturday, both President Trump and Secretary of State Mike Pompeo tweeted messages of support for the Iranian citizens who opposed the nation’s government.

“The voice of the Iranian people is clear. They are fed up with the regime’s lies, corruption, ineptitude, and brutality of the IRGC under @khamenei_ir's kleptocracy,” Pompeo wrote.