Rescue workers carry the body of a victim of a Ukrainian plane crash in Shahedshahr, southwest of the capital Tehran, Iran.
Part of the wreckage from Ukraine International Airlines flight PS752, a Boeing 737-800 plane that crashed after taking off from Tehran's Imam Khomeini airport on January 8, 2020.

Authorities in Iran are investigating why a Ukrainian passenger jet crashed minutes after takeoff from Tehran's airport early Wednesday, killing all 176 people on board.

The Ukraine International Airlines flight was bound for Kyiv with 167 passengers and nine crew members. Ukrainian Foreign Minister Vadym Prystaiko said the dead included 82 Iranians, 63 Canadians along with Ukrainians, Swedes, Afghans, Germans, and Britons.

The flag over the Canadian parliament in Ottawa was lowered to half-staff Wednesday. Prime Minister Justin Trudeau said the entire country is "shocked and saddened" as he promised to work for a thorough investigation.

A spokesman for U.N. Secretary-General Antonio Guterres says Guterres offers his condolences to the families of the victims and the various countries from which they came.

Iranian state television reports that both the black box voice and data recorder from the Boeing 737 aircraft had been recovered from the crash site, a swathe of farmland on the outskirts of the Iranian capital.

The semi-official Mehr News Agency quoted the head of Iran's civil aviation agency as saying he does not know which country will get the black boxes to for analysis, but says Iran won't hand them over to U.S.-based Boeing, the aircraft's manufacturer. The U.S. National Transportation Safety Board is often involved in investigations of overseas air crashes when a U.S. carrier or plane manufacturer is involved. But given the heightened tensions between Washington and Tehran, and the fact that the U.S. has no diplomatic relations with Iran, it was uncertain whether the NTSB would be involved.

One of the engines of Ukraine International Airlines flight PS752, a Boeing 737-800 plane that crashed after taking off from Tehran's Imam Khomeini airport on Jan. 8, 2020, is seen in this still image taken from Iran Press footage.

The fiery crash occurred hours after Iran launched a ballistic missile attack on Iraqi bases housing U.S. soldiers in response to last week's U.S. drone attack that killed Iranian Quds Force commander Qassem Soleimani.

Iranian officials said the crashed because of a mechanical failure. Ukrainian officials initially agreed with that assessment, but then backed away and declined to offer a possible cause while the investigation is ongoing.

But some U.S. aviation experts say they cannot see how Iran could possibly know that a mechanical problem caused the crash without looking at the flight data recorders or examining the engines.

Iranian officials dismiss speculation that a missile brought down the plane.

Imam Khomeini International Airport

President Volodymyr Zelenskiy urged the public "to refrain from ... making uncorroborated theories." He ordered a sweeping inspection of all civil airplanes in Ukraine "no matter the conclusions about the crash in Iran."

The Iranian road and transportation ministry said it appeared that one of the plane's two engines caught fire, with the pilot then losing control of the jetliner. The flight-tracking website FlightRadar24 said the plane never got above 2,500 meters.

An Iranian investigator said it appeared that the pilot was unable to communicate with air traffic controllers in the moments before the crash. Videos taken immediately after the crash show fires lighting up the darkened fields in the predawn hours.

Ukraine International Airline President Yevhen Dykhne said, "It was one of the best planes we had, with an amazing, reliable crew."

The jet was built in 2016. It was a Boeing 737-800 model, a commonly used commercial jet with a single-aisle cabin that is flown by airlines throughout the world. It is an older model than the Boeing 737 MAX, which has been grounded for nearly 10 months following two deadly crashes.