Iran said Saturday it "unintentionally" shot down a Ukrainian passenger jet, killing all 176 people on board, in an abrupt about-turn after initially denying Western claims it was struck by a missile.
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".
Supreme leader Ayatollah Ali Khamenei, who had reportedly learned the outcome of the investigation on Friday, offered his condolences and ordered the armed forces to address "shortcomings" so that such a disaster does not happen again.
The U-turn came after officials in Iran had for three days categorically denied Western claims that the Ukraine International Airlines (UIA) airliner had been struck by a missile in a catastrophic error.
The plane, which had been bound for Kiev, slammed into a field shortly after taking off from Tehran's Imam Khomeini International Airport before dawn on Wednesday.
It came only hours after Iran's armed forces launched a wave of missiles at bases hosting American forces in Iraq in response to the killing of Qasem Soleimani, one of Iran's top generals, in a US drone strike.
More From This Section
Iran had come under mounting pressure to allow a "credible" investigation after video footage emerged appearing to show the plane being hit by a fast-moving object before a flash appears.
Ukraine and Canada called for accountability after Iran's admission.
The military was first to acknowledge the error, saying the Boeing 737 had been mistaken for a "hostile target".
It said Iran 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 hit due to "human error".
Rouhani said Iran had been on alert for possible US attacks after Soleimani's "martyrdom".
"Iran is very much saddened by this catastrophic mistake and I, on behalf of the Islamic Republic of Iran, express my deep condolences to the families of victims of this painful catastrophe," the president said.
Rouhani added he had ordered "all relevant bodies to take all necessary actions (to ensure) compensation" to the families of those killed.
"This painful incident is not an issue that can be overcome easily." He said "the perpetrators of this unforgivable mistake will be prosecuted".
"It is necessary to take necessary steps and measures to remove the weak points of the country's defence systems so that such a catastrophe is never repeated again." The majority of passengers on UIA Flight PS752 were dual national Iranian-Canadians but also included Ukrainians, Afghans, Britons and Swedes.
Ukrainian President Volodymyr Zelensky demanded Iran punish those responsible for the downing of the plane and pay compensation.
"We expect Iran... to bring the guilty to the courts," he wrote on Facebook.
Canadian Prime Minister Justin Trudeau said closure and accountability were needed.
Trudeau also demanded "transparency, and justice for the families and loved ones of the victims".
"This is a national tragedy, and all Canadians are mourning together." The disaster came as tensions soared in the region after Soleimani's killing, and fears grew of an all-out war between Iran and its arch-enemy the United States.
Washington said the Soleimani strike was carried out to prevent "imminent", large-scale attacks on American embassies.
Tehran had vowed "severe revenge" for the killing of Soleimani before launching missiles at the bases in Iraq.
"Human error at time of crisis caused by US adventurism led to disaster," Iranian Foreign Minister Mohammad Javad Zarif tweeted.
"Our profound regrets, apologies and condolences to our people, to the families of all victims, and to other affected nations." Iran has invited the United States, Ukraine, Canada and others to join the crash investigation.
It 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.
Video footage of the UIA 737, which The New York Times said it had verified, emerged and appeared to show the moment the airliner was hit.
A fast-moving object is seen rising at an angle into the sky before a bright flash appears, which dims and then continues moving forward. Several seconds later, an explosion is heard and the sky lights up.
Many airlines from around the world cancelled flights to and from Iran in the wake of the crash, or rerouted flights away from Iranian airspace.
Nations around the world have called for restraint and de-escalation, and fears of a full-blown conflict have subsided after US President Donald Trump said Iran appeared to be standing down after targeting the US bases in Iraq.