This image taken from a video on Wednesday Jan. 8, 2020 shows a light in the sky which appears to show the Ukrainian jetliner plane on fire and crashing into ground. Western leaders have said the plane appeared to have been unintentionally hit by a surface-to-air missile near Tehran, just hours after Iran launched a series of ballistic missiles at two US bases in Iraq to avenge the killing of its top general in an American airstrike last week. Iran on Friday Jan. 10, 2020, denied the allegations. (UGC via AP)

TEHRAN, Iran (AP) — Iran announced Saturday that its military “unintentionally” shot down the Ukrainian jetliner that crashed earlier this week, killing all 176 aboard, after the government had repeatedly denied Western accusations that it was responsible.

The plane was shot down early Wednesday, hours after Iran launched a ballistic missile attack on two military bases housing U.S. troops in Iraq in retaliation for the killing of Iranian Gen. Qassem Soleimani in an American airstrike in Baghdad. No one was wounded in the attack on the bases.

A military statement carried by state media said the plane was mistaken for a “hostile target” after it turned toward a “sensitive military center” of the Revolutionary Guard. The military was at its “highest level of readiness,” it said, amid the heightened tensions with the United States.

“In such a condition, because of human error and in an unintentional way, the flight was hit,” the statement said. It apologized for the disaster and said it would upgrade its systems to prevent future tragedies.

It also said those responsible for the strike on the plane would be prosecuted.

Iran’s acknowledgment of responsibility for the crash was likely to inflame public sentiment against authorities after Iranians had rallied around their leaders in the wake of Soleimani’s killing. The general was seen as a national icon, and hundreds of thousands of Iranians had turned out for funeral processions across the country.

Watch Live: CBS News Coverage

If you don’t see the live player, go here »

But the vast majority of the plane victims were Iranians or Iranian-Canadians, and the crash came just weeks after authorities quashed nationwide protests ignited by a hike in gasoline prices.

“A sad day,” Iran’s Foreign Minister Mohammad Javad Zarif tweeted. “Human error at time of crisis caused by US adventurism led to disaster. Our profound regrets, apologies and condolences to our people, to the families of all victims, and to other affected nations.”

The jetliner, a Boeing 737 operated by Ukrainian International Airlines, went down on the outskirts of Tehran shortly after taking off from Imam Khomeini International Airport.

Iran had denied for several days that a missile caused the crash. But then the U.S. and Canada, citing intelligence, said they believed Iran shot down the aircraft with a surface-to-air missile, a conclusion supported by videos of the incident.

The plane, en route to the Ukrainian capital of Kyiv, was carrying 167 passengers and nine crew members from several countries, including 82 Iranians, at least 57 Canadians and 11 Ukrainians, according to officials. The Canadian government had earlier lower the nation’s death toll from 63.

“This is the right step for the Iranian government to admit responsibility, and it gives people a step toward closure with this admission,” said Payman Parseyan, a prominent Iranian-Canadian in western Canada who lost a number of friends in the crash.

“I think the investigation would have disclosed it whether they admitted it or not. This will give them an opportunity to save face.”

Associated Press writers Jon Gambrell and Joseph Krauss in Dubai, United Arab Emirates, and Rob Gillies in Toronto, contributed to this report.