Supporters and members of the Hashed al-Shaabi paramilitary force gather during a demonstration outside the US embassy in the Iraqi capital Baghdad

Pro-Iran demonstrators left the besieged US embassy in Baghdad on Wednesday after the Hashed al-Shaabi paramilitary force ordered them to withdraw a day after their dramatic incursion.

Thousands of Iraqi supporters of the largely Iranian-trained Hashed had encircled and vandalised the embassy compound Tuesday, outraged by US air strikes that killed 25 Hashed fighters over the weekend.

They marched unimpeded through the checkpoints of the usually high-security Green Zone to the embassy gates, where they broke through a reception area, chanting "Death to America" and spraying pro-Iran graffiti on the walls.

Iraq's caretaker premier Adel Abdel Mahdi called on the angry crowd to leave the embassy, but most spent the night in dozens of tents set up outside the perimeter wall.

On Wednesday morning, crowds of men brandished the Hashed's colours, torched US flags and hurled rocks towards the compound.

Security personnel inside responded with tear gas, wounding at least 20 people, the Hashed said.

By the afternoon, the Hashed called on its supporters to leave the embassy and regroup outside the Green Zone "out of respect for the state."

"You delivered your message," it said in a statement.

AFP's photographer saw protesters dismantling their tents and leaving the Green Zone.

"We burned them!" they said, streaming back out of checkpoints they had breezed through on Tuesday.

Kataeb Hezbollah, the group targeted in the US raids, initially told AFP it would stay at the embassy, but later said it had decided to abide by the Hashed's order.

"We scored a huge win: we arrived to the US embassy, which no one had done before," spokesman Mohammad Mohyeddin told AFP.

"Now, the ball is in parliament's court," he added, referring to lawmakers' efforts to revoke the legal cover for 5,200 US troops to deploy in Iraq.

- 'You can't do a thing' -

Tuesday's embassy attack was the latest episode in spiralling tensions between the US and Iran since Washington abandoned a landmark nuclear deal with Tehran in 2018.

Many of those tensions have played out in Iraq, which has close ties with both governments.

US forces have faced a spate of rocket attacks in recent months, including one last week that killed a US contractor and prompted the weekend air strikes.

President Donald Trump and other US officials have blamed Iran for attacks on US forces and the embassy.

"They will pay a very BIG PRICE! This is not a Warning, it is a Threat," Trump wrote on Twitter, adding "Happy New Year!"

Iran's supreme leader condemned US strikes on Iraq and warned his country was ready to hit back.

"First of all, you can't do a damn thing! This has nothing to do with Iran," Ayatollah Ali Khamenei said in a speech on state television.

"If the Islamic republic decides to oppose or fight against a country, it will do this explicitly," he said.

- 'Our hands are tied' -

By Wednesday, Iraqi forces had reimposed normal security measures around the perimeter of the Green Zone, usually inaccessible without a badge.

US officials were alarmed that protesters crossed checkpoints so easily on Tuesday.

An Iraqi special forces fighter assigned to guard the Green Zone told AFP his units had no orders to intervene.

"If I had had orders to act, I could have fired and stopped the storming of the embassy," he said.

"But after what happened, our hands are tied. We can't prevent the situation from deteriorating," he added.

US officials have pressured Iraqi authorities to step up security and sent a rapid response team of Marines overnight to help guard the compound.

Pentagon chief Mark Esper said around 750 troops from the 82nd Airborne Division were prepared to deploy to the region in the coming days.

US Secretary of State Mike Pompeo postponed a trip to Ukraine to monitor from Washington "the ongoing situation in Iraq and ensure the safety and security of Americans in the Middle East," a spokeswoman said.

Pompeo spoke with premier Mahdi Wednesday and "noted the measures the Government of Iraq has taken to improve the security situation," the State Department said.

Pompeo also stressed it was the Iraqi government's responsibility to prevent further attacks on the embassy, it added.

No US personnel were injured in the attack and US officials said they had no plans to evacuate.

Ambassador Matthew Tueller was said to be on his way back to Baghdad from holiday but had yet to arrive on Wednesday afternoon.

Story continues