Dominic Raab, the U.K.'s foreign secretary | Tolga Akmen/AFP via Getty Images UK warns Iran over arrest of British ambassador Rob Macaire was briefly detained after attending a vigil in Tehran.

British Foreign Secretary Dominic Raab on Saturday denounced the arrest of the U.K. ambassador to Iran as a "flagrant violation of international law."

The ambassador, Rob Macaire, said he was detained for half an hour on Saturday evening after attending a vigil in Tehran for those who died in the downing of an Ukraine International Airlines flight, for which Iran has taken responsibility.

The vigil turned into a protest, prompting the ambassador to leave. Macaire was arrested on his way back to the embassy.

Raab said the ambassador had been arrested "without grounds or explanation," adding: "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."

Thanks for the many goodwill messages. Can confirm I wasn’t taking part in any demonstrations! 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. — Rob Macaire (@HMATehran) January 12, 2020

Iran's official news agency IRNA said Sunday that the country's foreign ministry "awaits details" about the ambassador's arrest, reporting that Macaire had been arrested "for taking part in the protest."

Macaire on Sunday morning denied taking part in any demonstration, saying: "I left after 5 mins, when some started chanting."

Ambassadors have diplomatic immunity under the 1961 Vienna Convention on Diplomatic Relations.

The EU's foreign policy chief Josep Borrell expressed concern over Macaire's detention, tweeting: "Full respect of the Vienna convention is a must. The EU calls for deescalation and space for diplomacy."

Also on Sunday, Raab called on Iran to "come to the negotiating table" to avoid the conflict escalating any further.

In an opinion article for the Sunday Telegraph, Raab wrote: "No one wants a Middle Eastern war ... We need to de-escalate the situation. But we must also stop Iran from acquiring a nuclear weapon."

Raab said Tehran had "stretched [the U.K.'s] patience" when it declared it would step down from commitments made under the Iran nuclear deal following the U.S. killing of Iranian general Qassem Soleimani. He said the U.K., Germany and France "made clear we are now considering triggering the dispute resolution mechanism" of the deal.

The downing of the Ukrainian Airways Flight has brought the Iranian regime to a "crossroads," Raab wrote.

"It is time for them to come to the negotiating table. If Iran has the will, Britain will use its diplomatic energy to work with all of our allies to chart a peaceful way forwards," he added.