Iran has struck back at the United States for killing its most powerful military commander, firing a barrage of ballistic missiles at two Iraqi military bases that house American troops.

The Iranian supreme leader said the attack was a “slap” against America’s military presence in the region.

The retaliation is another dangerous escalation that could draw the region deeper into turmoil, despite insistence by Washington and Tehran that neither side wants war.

US and Iraqi officials said there were no casualties among their forces.

Ayatollah Ali Khamenei made clear that Iran’s missile strikes were in revenge for the US killing of Revolutionary Guard General Qassem Soleimani.

His death last week in an American drone strike in Baghdad prompted angry calls for vengeance and drew massive crowds of Iranians to the streets to mourn him.

Ayatollah Khamenei himself wept at the funeral in a sign of his bond with the commander.

“Last night they received a slap,” Ayatollah Khamenei said in a speech after the missile strikes.

“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.”

Despite the heightened rhetoric, there were some indications that there might not be more immediate retaliation by either side.

“All is well!” President Donald Trump tweeted shortly after the missile attacks, adding, “So far, so good” regarding the assessment of casualties and damage.

Moments earlier, 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.

It appeared Iran gave advance warning of the strikes.

Iran missile strikes in Iraq
(PA Graphics)

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 American positions.

Finland and Lithuania’s militaries, 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,” Mr Rome said.

Tensions have risen steadily in the Middle East since Mr Trump’s decision to unilaterally withdraw America from Tehran’s nuclear deal with world powers.

The Iranian strikes on the bases marked the first time in recent years that Iran has directly attacked US positions rather than through proxies in the region.

It raised the chances of open conflict erupting between the two rivals, who 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 plane with 176 people crashed after takeoff just outside Tehran on Wednesday morning, killing all on board, Iranian state TV and Ukrainian officials said.

Debris is seen from a Ukrainian plane which crashed in Shahedshahr, south west of Tehran, Iran
Debris from a Ukrainian plane which crashed in Shahedshahr, south west of Tehran (Ebrahim Noroozi/AP)

Mechanical issues were suspected.

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.

Ukraine’s 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 mis-identification” for civilian aircraft in the Persian Gulf.

The agency barred US pilots and carriers from flying over areas of Iraqi, Iranian and some Persian Gulf airspace.

The US has been deploying more troops in the region.

US Gulf allies that host thousands of American troops are concerned about an outbreak of direct conflict and retaliation from Iran.

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 told reporters on Wednesday, stressing that Iran is a neighbour and the last thing the country wants is more tension in the region.

Estimated range of Iranian missiles
(PA Graphics)

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 a total of 15 missiles in Wednesday’s strike, two US officials said.

Ten hit the Ain al-Asad air base in Iraq’s western Anbar province and one targeted a base in Irbil in Iraq’s semi-autonomous Kurdish region. Four failed, said the officials.

“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,” Jonathan Hoffman, an assistant to the US defence secretary, said.

Two Iraqi security officials said a missile appeared to have struck a plane at Ain al-Asad, igniting a fire.

There were no immediate reports of casualties from the attacks, according to the officials.

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

It houses about 1,500 US and coalition forces.

Mr Trump visited it in December 2018, making his first presidential visit to troops in the region.