Washington (AFP) - US President Donald Trump said Saturday the United States was monitoring Iranian demonstrations closely, warning against any new "massacre" as protests broke out after Tehran admitted to shooting down a passenger plane.

Iran said earlier it unintentionally downed a Ukrainian jetliner outside Tehran, killing all 176 people aboard, in an abrupt about-turn after initially denying Western claims it was struck by a missile. The firing came shortly after Iran launched missiles at bases in Iraq housing American forces.

President Hassan Rouhani said a military probe into the tragedy had found "missiles fired due to human error" brought down the Boeing 737, calling it an "unforgivable mistake."

At a student protest to pay tribute to the crash victims on Saturday, Iranian authorities briefly detained Britain's ambassador, in what the British government called a violation of international law. He was later released.

Trump told Iranians -- in tweets in both English and Farsi -- that he stands by them and is monitoring the demonstrations.

"To the brave, long-suffering people of Iran: I've stood with you since the beginning of my Presidency, and my Administration will continue to stand with you," he tweeted.

"There can not be another massacre of peaceful protesters, nor an internet shutdown. The world is watching," he added, apparently referring to an Iranian crackdown on street protests that broke out in November.

"We are following your protests closely, and are inspired by your courage," he said.

The new demonstrations follow an Iranian crackdown on street protests that broke out in November. Amnesty International has said it left more than 300 people dead.

Internet access was reportedly cut off in multiple Iranian provinces ahead of memorials planned a month after the protests.

Canadian Prime Minister Justin Trudeau has demanded that Iran provide "full clarity" on the downing of the plane. Ottawa says the dead included 57 Canadians.

Story continues

Iran's Supreme Leader Ayatollah Ali Khamenei also offered his condolences and ordered the armed forces to address "shortcomings" so that such a disaster does not happen again.

Tehran's acknowledgement came after officials in Iran denied for days Western claims that the Ukraine International Airlines plane had been struck by a missile in a catastrophic error.

The Kiev-bound jet slammed into a field shortly after taking off from Tehran's Imam Khomeini International Airport on Wednesday.

The crash came hours after Tehran launched missiles at bases hosting American forces in Iraq in response to the killing of top Iranian general Qasem Soleimani in a US drone strike.

Fears grew of an all-out war between Iran and its arch-enemy the United States, but those concerns have subsided after Trump said Tehran appeared to be standing down after targeting the US bases.

- Protesters 'dispersed' -

On Saturday evening, police dispersed students who had converged on Amir Kabir University in Tehran to pay tribute to the victims, after some among the hundreds gathered shouted "destructive" slogans, Fars news agency said.

British Foreign Secretary Dominic Raab said UK envoy Rob Macaire had been detained.

"The arrest of our ambassador in Tehran without grounds or explanation is a flagrant violation of international law," Raab said in a statement. The US called on Iran to apologize.

Iran's Tasnim News Agency, which is close to the country's conservatives, said the envoy had been "provoking radical acts" among students. He was released a few hours later and would be summoned again by Iranian officials on Sunday, it said.

State television reported that students shouted "anti-regime" chants, while Fars reported that posters of Soleimani had been torn down.

The aerospace commander of Iran's Revolutionary Guards accepted full responsibility for Wednesday's accident.

But Brigadier General Amirali Hajizadeh said the missile operator acted independently, targeting the 737 after mistaking it for a "cruise missile".

The operator failed to obtain approval from his superiors because of disruptions to a communications system, he said.

"He had 10 seconds to decide. He could have decided to strike or not to strike and under such circumstances, he took the wrong decision."

- Justice, compensation -

Iran had been under mounting international pressure to allow a "credible" investigation after video emerged appearing to show the moment the airliner was hit.

In footage that the New York Times said it had verified, a fast-moving object is seen rising into the sky before a bright flash appears. Several seconds later, an explosion is heard.

Iran's military said it had been at the highest level of alert after American "threats" and that the plane had turned and come close to a "sensitive" military site before it was targeted due to "human error."

Rouhani said Iran had been on alert for possible US attacks after Soleimani's "martyrdom."

Rouhani added he had ordered "all relevant bodies to take all necessary actions (to ensure) compensation" to the families of those killed.

The majority of passengers on Flight PS752 were Iranians and Canadians, including dual nationals, while Ukrainians, Afghans, Britons and Swedes were also aboard.

Rouhani told his Ukrainian counterpart Saturday that "all the persons involved in this air disaster will be brought to justice," Ukraine's presidency said.

This is Iran's worst civil aviation disaster since 1988 when the US military said it shot down an Iran Air plane over the Gulf by mistake, killing all 290 people on board.

burs/bfm/dw