"We have great military equipmet but we don't want to use it," Donald Trump said. (AFP)

US President Donald Trump said on Wednesday Iranian missile strikes on bases in Iraq had not harmed any US troops stationed there and damage was minimal, an outcome he said showed Tehran wanted to prevent an escalation into conflict.

Iranian forces fired missiles at military bases housing US troops in Iraq early on Wednesday, saying it was in retaliation for the killing in a US drone strike of powerful Iranian commander Qassem Soleimani on Jan. 3.

"All of our soldiers are safe and only minimal damage was sustained at our military bases," Trump said. "Iran appears to be standing down, which is a good thing for all parties concerned and a very good thing for the world."

"The fact that we have this great military and equipment, however, does not mean we have to use it. We do not want to use it," the US president said in an address, flanked by Vice President Mike Pence, Defense Secretary Mark Esper and Secretary of State Mike Pompeo and military officers.

He urged world powers to quit a 2015 nuclear accord with Iran that Washington withdrew from in 2018 and work for a new deal, an issue that has been at the heart of rising tension between Washington and Tehran. Iran has rejected new talks.

There was no immediate reaction from Iranian officials to Trump's comments. The semi-official Fars news agency described the US president's remarks as a "big retreat from threats."

Iranian Supreme Leader Ayatollah Ali Khamenei, who earlier on Wednesday addressed a gathering of Iranians chanting "Death to America", said Iran's attacks were a "slap on the face" of the United States and said US troops should leave the region.

Iranian Foreign Minister Mohammad Javad Zarif had said the strikes "concluded" Tehran's response to the killing of Soleimani, who had been responsible for building up Iran's network of proxy armies across the Middle East. He was buried in his hometown Kerman on Monday after days of national mourning.

"We do not seek escalation or war, but will defend ourselves against any aggression," he wrote on Twitter.

Election Year

Trump's reaction in the immediate aftermath of Wednesday's attacks had been to say on Twitter that "All is well!" and that Washington was assessing damage.

That early tweet and the comment by Iran's foreign minister had acted to soothe some initial concerns about a wider war and calmed jittery financial markets. Oil prices slipped back after an early spike.

US and European government sources said they believed Iran had deliberately sought to avoid US military casualties in its missile strikes to prevent an escalation.

But an Iranian army spokesman had denied "foreign media reports" suggesting there had been some kind of coordination between Iran and the United States before the attack to allow bases to be evacuated, Fars news agency said.

The US president, who was impeached last month and faces an election this year, had at the weekend threatened to target 52 Iranian sites if Iran retaliated for Soleimani's killing.

Iranian state television said Iran had fired 15 ballistic missiles from its territory at US targets in its neighbour Iraq early on Wednesday. The Pentagon said al-Asad air base and another facility in Erbil in Iraq were struck.

Iranian television had said 80 "American terrorists" had been killed, without saying how it obtained this information.

Germany, Denmark, Norway and Poland said none of their troops in Iraq were hurt. Britain, which also has personnel in Iraq, condemned the Iranian action. Iraq said its forces did not suffer casualties.

Iranian television reported an official in the supreme leader's office as saying the missile attacks were the "weakest" of several retaliation scenarios. It quoted another source saying Iran had lined up 100 other potential targets.

State media showed footage of what it said were Iran's missiles being fired into the night sky. In the background, voices shouted "God is greatest".

Avoiding Conflict

But analysts said Iran wanted to avoid any conventional military conflict with superior US forces.

US officials said Soleimani was killed because forces under his command planned attacks on US targets, although they did not provide evidence.

Before Soleimani was buried, his body was taken on a tour of cities in Iraq and Iran, drawing huge crowds. A stampede at his funeral on Tuesday killed at least 56 people.

After the Iranian missile attack, state television showed footage of the burial, with hundreds of people chanting "God is greatest" when the strikes were announced over loudspeakers.

"His revenge was taken and now he can rest in peace," Iranian television said.

Friction between Iran and the United States rose after Trump withdrew from the nuclear deal between Iran and world powers, approved by his predecessor Barack Obama, and reimposed sanctions on Tehran slashing its vital oil exports.

"We must all work together toward making a deal with Iran that makes the world a safer and more peaceful place," he said.

Khamenei, in his speech on Wednesday, ruled out any resumption of talks with Washington on the 2015 nuclear pact.

Trump's US political rivals have challenged his decision to order Soleimani's killing and questioned its timing in a US election year.