Fighters with Iran-backed militias in Iraq, known as the Popular Mobilization Forces, wave Iraqi flags while mourners and family members prepare to bury the body of Abu Mahdi al-Muhandis, deputy commander of Iran-backed militias who was killed in a US airstrike in Iraq on Friday, in Najaf on Wednesday. Picture: AP Photo/Anmar Khalil

Tehran, Iran – Iran struck back at the United States early on Wednesday for killing its most powerful military commander, firing a barrage of ballistic missiles at two Iraqi military bases that house American troops in what the Iranian supreme leader said was a “slap” against the US military presence in the region.

The dramatic blast of more than a dozen missiles caused no casualties, however, and US President Donald Trump said hours later that Iran “appears to be standing down".

It was a signal that both sides were stepping away from an immediate spiral of more direct exchanges that could throw the Middle East into great turmoil.

Speaking at the White House, Trump said the US would impose new “punishing economic sanctions” on Iran to force it to stop its nuclear program and what he called its “hostilities” in the region. But he also said Washington was open to a deal with Tehran.

Iran, in turn, appeared to have calibrated its attack to avoid stoking further US retaliation, giving some early warning to its Iraqi allies to avoid casualties.

“Last night they received a slap,” Supreme Leader Ayatollah Ali Khamenei said of the Americans in a speech after the missile strikes.

He made it clear that Iran's actions were in response to the US killing of their most powerful military commander. 

“These military actions are not sufficient (for revenge). What is important is that the corrupt presence of America in this region comes to an end."

Satellite imagery showed at least five impact sites on the Ain al-Asad base in Iraq’s western Anbar province, each leaving charred blast marks that damaged or destroyed buildings. 

One obliterated a structure in a row of buildings next to a line of helicopters, though none of the aircraft appeared damaged, according to the imagery provided by Planet Labs, Inc.

Iran's foreign minister tweeted that Tehran had taken and "concluded proportionate measures in self-defence”, adding that Tehran did “not seek escalation" but would defend itself against further aggression.

Iraqi Prime Minister Adel Abdul-Mahdi said he received notification from Iran just after midnight that its retaliation “was starting or would start soon” and would focus only on US positions. 

The militaries of Finland and Lithuania, which had personnel at one of the targeted bases, said they received information about an imminent attack and had time to move to shelters or leave the base.

Iran’s attacks “appeared designed for maximum domestic effect with minimum escalatory risk”, said Henry Rome, analyst with Eurasia Group.

"For a president who wants to avoid a war in the Middle East during an election year, the Iranians have provided an off-ramp he will likely take," Rome said.

The Iranian attacks on the bases marked the first time in recent years that Iran has directly attacked US positions. 

Tehran and Washington have been at odds since Iran's 1979 Islamic Revolution and the subsequent US embassy takeover and hostage crisis.

Adding to the chaos, a Ukrainian airplane with 176 people crashed after takeoff just outside Tehran on Wednesday morning, killing all on board, Iranian and Ukrainian officials said. Iran said mechanical issues were suspected, although Ukraine declined to offer a cause while an investigation continues.

The Boeing 737-800 had taken off from Imam Khomeini International Airport, bound for the Ukrainian capital, Kyiv. 

The plane carried 167 passengers and nine crew members. Ukrainian Foreign Minister Vadym Prystaiko said there were 82 Iranians, 63 Canadians and 11 Ukrainians on board – the Ukrainian nationals included two passengers and the nine crew. 

The rest were Swedish, Afghan, German and British nationals.

The US Federation Aviation Administration earlier warned of a "potential for miscalculation or misidentification" for civilian aircraft in the Persian Gulf. The agency barred US carriers from flying over areas of Iraqi, Iranian and some Persian Gulf countries.

The US has been deploying more troops in the region. 

US Gulf allies that host thousands of American troops are concerned about a direct conflict. Saudi Arabia and the United Arab Emirates have called for de-escalation.

“The situation is not currently a war situation,” UAE Energy Minister Suhail Al-Mazrouei said, stressing that Iran is a neighbour and the last thing the country wants is more regional tension.

Iran’s Revolutionary Guard warned the US and its allies against retaliating over the missile attack.

“We are warning all American allies, who gave their bases to its terrorist army, that any territory that is the starting point of aggressive acts against Iran will be targeted,” the Guard said in a statement carried by Iran’s state-run IRNA news agency. It also threatened Israel.

The Iranians fired 15 missiles Wednesday, two US officials said. Ten hit Ain al-Asad and one targeted a base in Irbil in Iraq's semi-autonomous Kurdish region. Four failed, said the officials, who were not authorised to speak publicly about a military operation.

“As we evaluate the situation and our response, we will take all necessary measures to protect and defend US personnel, partners and allies in the region,” said Jonathan Hoffman, an assistant to the US defence secretary.

Two Iraqi security officials said a missile appeared to have hit a plane at Ain al-Asad, igniting a fire. There were no immediate reports of casualties from the attacks, according to the officials, who spoke on condition of anonymity because they did not have permission to talk to journalists.

Ain al-Asad was first used by American forces after the 2003 US-led invasion that toppled dictator Saddam Hussein, and it later was used by American troops in the fight against the Islamic State group. 

It houses about 1 500 US and coalition forces. Trump went there in December 2018, making his first presidential visit to troops in the region. Vice President Mike Pence also has visited.

As Iran reels from the loss of life in the plane crash, it is also contending with the aftermath of a deadly stampede Tuesday at Soleimani's funeral in his hometown of Kerman, killing 56 people and injuring more than 200. 

Shortly after Wednesday's missile attack, Soleimani's shroud-wrapped remains were lowered into the ground as mourners wailed at the grave site.

“We tell our enemies that we will retaliate, but if they take another action we will set ablaze the places that they like and are passionate about," Hossein Salami, who commands the Revolutionary Guard, told a crowd in Kerman.

The general's funeral procession in major cities spanning three days was an unprecedented honour for Soleimani, seen by Iranians as a national hero for his work leading the Guard’s expeditionary Quds Force in the face of US pressure.

The US blames him for killing US troops in Iraq. The Trump administration alleges he'd been plotting new attacks just before he was killed.

Many Sunni Muslims in the region, however, view him as a destabilising figure.

Since his killing, Tehran has abandoned the remaining limits of its 2015 nuclear deal with world powers. In Iraq, lawmakers and pro-Iranian factions in parliament have voted to oust American troops from Iraqi territory.

Kuwait said Wednesday that its state-run KUNA news agency’s Twitter account was hacked and posted a false story on US troops withdrawing from the nation. The fake alert went out on its account, Kuwait said. 

More than 13 000 US troops are stationed in Kuwait, with more now on the way.

AP