The UK's ambassador to Iran has been summoned by Iranian authorities as they claim he attended an "illegal" anti-government rally.
Rob Macaire denies the accusations, saying he went to an event advertised as a vigil for the victims of the Ukrainian plane shot down by an Iranian missile - and left when it turned into a protest.
Hundreds of people chanted against the country's leaders - including Supreme Leader Ayatollah Ali Khamenei - and police dispersed them with tear gas.
Mr Macaire was arrested, and Iran's deputy foreign minister Abbas Araghchi later said he was detained "as an unknown foreigner in an illegal gathering".
The ambassador tweeted to say arresting diplomats is "illegal".
"Can confirm I wasn't taking part in any demonstrations!" Mr Macaire said. "Went to an event advertised as a vigil for victims of #PS752 tragedy. Normal to want to pay respects - some of victims were British. I left after 5 mins, when some started chanting."
The UK said its envoy was detained "without grounds or explanation" and in "flagrant violation of international law".
Foreign Secretary Dominic Raab said Tehran was at a crossroads - with the prospect of continuing political and economic isolation unless it engages diplomatically with the West.
Mr Araghchi said once he was aware of Mr Macaire's identity, he was released.
Iran's Foreign Ministry later summoned the ambassador over his "illegal and inappropriate presence" at the protest, it said on its Telegram channel.
Riot police have been deployed in Iran's capital amid calls for more anti-government protests on Sunday.
Officers have gathered in Vali-e Asr Square in Tehran, and a large black banner has been displayed there which bears the names of the 176 plane crash victims.
The US President, Donald Trump, has tweeted to say "the world is watching" the leaders of Iran, and warned them "DO NOT KILL YOUR PROTESTORS".
The passenger plane was shot down as Iran braced for retaliation after firing ballistic missiles at two bases in Iraq housing American forces.
The ballistic missile attack, which caused no casualties, was a response to the killing of General Qassem Soleimani, Iran's top general, in a US airstrike in Baghdad.
There has been anger expressed in Iran over the shooting down of the airliner, and explanations from senior officials in the aftermath.
Cover image: a picture of top Iranian General Qasem Soleimani is seen in Tehran, Iran (Picture: PA).