Britain's Foreign Office confirmed on Saturday that the country's ambassador in Tehran was briefly detained by Iranian authorities, denouncing the arrest as a "flagrant violation of international law."

Earlier, the Tehran-based Tasnim news agency reported that British envoy Rob Macaire was arrested for several hours in front of Amirkabir University for inciting anti-government protesters.

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

"The Iranian government is at a crossroads moment. It can continue its march toward pariah status with all the political and economic isolation that entails, or take steps to de-escalate tensions and engage in a diplomatic path forwards," Raab said.

Earlier, hundreds gathered at universities in Tehran on Saturday night to protest the Iran government's late acknowledgement that it "unintentionally'' shot down the Ukrainian jetliner that crashed earlier this week, after the government had for days repeatedly denied Western accusations and mounting evidence that it was responsible.

A military statement carried by state media earlier on Saturday said the plane was mistaken for a "hostile target" after it turned toward a "sensitive military centre" of Iran's Revolutionary Guard. The military was at its "highest level of readiness," it said, amid the heightened tensions with the United States.

Demonstrators are seen in front of the Amirkabir University in Tehran, Iran, on Saturday. (Atta Kenare/AFP via Getty Images)

Iran President Hassan Rouhani tweeted: "Iran deeply regrets this disastrous mistake."

The protesters demanded officials involved in the missile attack be removed from their positions and tried.

The semi-official Fars news agency reported demonstrators ripped up pictures of Iranian Gen. Qassem Soleimani, who was killed in a targeted attack by the U.S. earlier this month.

Police later broke up the demonstrations.

The Kyiv-bound flight PS752 plane was shot down early Wednesday — killing all 176 aboard, including 57 Canadians — hours after Iran launched a ballistic missile attack on two military bases housing U.S. troops in Iraq in retaliation for the killing of Soleimani in an American airstrike in Baghdad. No one was hurt in the attack on the U.S. bases.

Iranians had rallied around their leaders after the killing of Soleimani, who was seen as a national icon for building up armed groups across the region that project Iranian influence and battle the Islamic State group and other perceived enemies.

The shooting down of the plane and the lack of transparency around it could reignite anger at the country's leadership. Iran has already seen unrest over joblessness and the expense of basic household goods.

'We need full clarity'

Abroad, various governments condemned the strike on the passenger jet and demanded a full investigation.

Canadian Prime Minister Justin Trudeau said he told Rouhani that Iran's admission was an important step in providing answers for families, but that more must be done.

"A full and complete investigation must be conducted," Trudeau said. "We need full clarity on how such a horrific tragedy could have occurred."

Watch: Trudeau says Iran must take 'full responsibility'

Prime Minister Justin Trudeau held a news conference in Ottawa on Saturday, saying Iran must take "full responsibility" and that a full and complete investigation must be conducted. 6:12

In their conversation, he said Rouhani promised further investigation into the circumstances surrounding the plane crash.

Ukraine's President Volodymyr Zelensky said the crash investigation should continue and the "perpetrators" should be brought to justice. He said Iran should compensate victims' families — Prime Minister Oleksiy Honcharuk had separately said Ukraine would pay 200,000 hryvnia each to families (about $11,000 Cdn) — and he requested "official apologies through diplomatic channels."

Zelensky thanked the U.S, Britain, Canada and others for information about the crash and their support. He says that support "undoubtedly helped" push Iran to acknowledge its responsibility for the crash.

The crash killed 11 Ukrainians and three Britons.

The Ukrainian airline criticized Iran's decision to leave its airspace open despite the hostilities.

"It's absolutely irresponsible," Ukraine International Airlines vice president Ihor Sosnovskiy told reporters. "There must be protection around ordinary people. If they are shooting somewhere from somewhere, they are obliged to close the airport."

Watch: Why flight 752 could take off amid missile strikes