A Ukrainian plane that crashed in Iran killing 176 people, was checked just two days before the accident, which officials say was caused by a fire in one of its engines.

Ukraine’s minister for foreign affairs Vadym Prystaiko confirmed the nationalities of those killed including 82 passengers from Iran and 63 Canadians. Two passengers and nine crew were from Ukraine, there were 10 from Sweden, 4 from Afghanistan, 4 from Germany, and 3 from the UK.

Flight PS752 had been delayed from taking off by almost an hour from Tehran’s Imam Khomeini International Airport.

It took off to the west, but never made it above 8,000 feet in the air, according to data from the flight-tracking website FlightRadar24. It remains unclear what happened.

Qassem Biniaz, a spokesman for Iran’s Road and Transportation Ministry, said it appeared a fire struck one of its engines.

The pilot of the aircraft then lost control of the plane, sending it crashing into the ground, Biniaz said, according to the state-run IRNA news agency.

Hassan Razaeifar, the head of air crash investigation committee, said it appeared the pilot couldn’t communicate with air-traffic controllers in Tehran in the last moments of the flight. He did not elaborate.

Ukrainian President Volodymyr Zelensky ordered a sweeping inspection of all civil airplanes in the country, “no matter the conclusions about the crash in Iran.”

Ukraine International Airlines said the plane was checked only two days before the accident.

“The plane was manufactured in 2016, it was received by the airline directly from the (Boeing) factory. The plane underwent its last planned technical maintenance on January 6, 2020,” the airline said in a statement.

Ukrainian authorities have offered to help with the investigation of the plane crash.

“We’re preparing a group of specialists in order to help with the search operation and the investigation of the cause of the crash,” Ukrainian Prime Minister Oleksiy Honcharuk said.

There were 167 passengers and nine crew on board the Boeing 737 when it crashed and they were all killed.

The plane, fully loaded with fuel for its 2,300-kilometre flight, slammed into farmland near the town of Shahedshahr on the outskirts of Tehran.

Videos taken immediately after the crash show blazes lighting up the darkened fields before dawn.

Resident Din Mohammad Qassemi said he had been watching the news about the Iranian ballistic missile attack on US forces in Iraq in revenge for the killing of Revolutionary Guard Gen. Qassem Soleimani when he heard the crash.

“I heard a massive explosion and all the houses started to shake. There was fire everywhere,” he told The Associated Press.

“At first I thought (the Americans) have hit here with missiles and went in the basement as a shelter. After a while, I went out and saw a plane has crashed over there. Body parts were lying around everywhere.”

The Ukraine International Airlines plane had taken off shortly after 6am (local time) and it went down in farmland outside of Iran’s capital.

Staff at the Boryspil airport in Kiev, where the plane was headed, told The Associated Press that passengers on this flight were usually Iranian students coming back to Ukraine after winter holidays.

Associated Press journalists who reached the crash site saw a wide field of field of debris scattered across farmland. The dead lay among shattered pieces of the aircraft.

State media earlier reported that the crash was suspected to have been caused by mechanical issues, without elaborating.

Iran’s Civil Aviation Authority later said: “The cause of the Ukraine International Airlines 737 crash is not clear yet”.

A video has emerged which appears to show the plane on fire in the sky before it crashes, however the footage has not been verified.

BBC journalist Bahman Kalbasi posted video of the smouldering crash site, describing it as “gut wrenching”. Another video shows large pieces of the plane and body bags at the scene.

The Iran Red Crescent Society, a non-governmental humanitarian organisation in Iran, posted photos of the crash site and said there was no chance anyone had survived the crash.

Aviation analyst Alex Macheras also noted that Iran’s state media had blamed technical problems soon after the accident without any investigation.

An investigation team was at the site of the crash in southwestern outskirts of Tehran, civil aviation spokesman Reza Jafarzadeh said.

“After taking off from Imam Khomeini International Airport, it crashed between Parand and Shahriar,” Jafarzadeh said.

“An investigation team from the national aviation department was dispatched to the location after the news was announced.”

Ukraine’s President Volodymyr Zelenskiy extended his condolences to the families of the victims.

His office said he had cut his visit to Oman short and was returning to Kiev because of the crash. The country’s Prime Minister Oleksiy Honcharuk confirmed the casualty toll.

“Our task is to establish the cause of the crash of the Boeing and provide all necessary help to the families of the victims,” said parliament speaker, Dmytro Razumkov, in a Facebook statement.

Flight data from the airport showed a Ukrainian 737-800 flown by Ukraine International Airlines took off Wednesday morning, then stopped sending data almost immediately afterward, according to website FlightRadar24.

The airline did not immediately respond to a request for comment.

Boeing has tweeted a statement saying: “We are aware of the media reports out of Iran and we are gathering more information”.

Journalist Hakan Celik tweeted that the plane, which was a Boeing 737-800 serial 38124, was only 3.5 years old.

The crash came hours after Iran launched a ballistic missile attack targeting two bases in Iraq housing US forces in retaliation for the killing of Revolutionary Guard General Qassem Soleimani.

The US Federal Aviation Administration said Tuesday it was banning US-registered carriers from flying over Iraq, Iran and the Gulf following rocket attacks on US forces in Iraq.

“The (FAA) issues Notices to Airmen tonight outlining flight restrictions that prohibit US civil aviation operators from operating in the airspace over Iraq, Iran and the waters of the Persian Gulf and the Gulf of Oman,” it said in a statement.

“The FAA will continue closely monitoring events in the Middle East.”

The Boeing 737-800 is not to be confused with the 737 MAX, which has been grounded since March after two crashes in Indonesia and Ethiopia killed 346 people within five months.

It is a very common single-aisle, twin-engine jetliner used for short to medium-range flights. Thousands of the planes are used by airlines around the world.

Introduced in the late 1990s, it is an older model than the Boeing 737 MAX.