US President Donald Trump warned Iran that it faces significant retaliation if Americans are killed or its facilities damaged in attacks by the Islamic Republic.

"Iran will be held fully responsible for lives lost, or damage incurred, at any of our facilities," Mr Trump said on Twitter, after pro-Iranian protesters stormed the US embassy in Baghdad.

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

Mr Trump also said the embassy is safe, adding that "many of our great Warfighters, together with the most lethal military equipment in the world, was immediately rushed to the site".

Mr Trump thanked Iraqi Prime Minister Adel Abdel Mahdi and President Barham Saleh for "their rapid response upon request" to the embassy attack.

Mr Trump spoke with Mr Abdel Mahdi earlier by telephone, stressing the need to protect Americans and US facilities in Iraq, the White House said.

The US sent additional forces to its embassy in Baghdad as protesters breached its outer wall.

The demonstrators were protesting US air strikes that killed at least 25 fighters from a hardline Hashed faction known as Kataeb Hezbollah (Hezbollah Brigades) on Sunday.

Those strikes were in response to a 36-rocket attack last week that killed one US contractor at an Iraqi base, the latest in a string of attacks on areas where US troops are deployed.

They have not been claimed but US security assessments have largely blamed them on Kataeb Hezbollah.

US Defense Secretary Mark Esper also called on the Iraqi government to help protect American personnel.

"We have taken appropriate force protection actions to ensure the safety of American citizens, military personnel and diplomats in country, and to ensure our right of self-defence," Mr Esper said in a statement.

"As in all countries, we rely on host nation forces to assist in the protection of our personnel in country, and we call on the government of Iraq to fulfill its international responsibilities to do so," he added.

"US personnel are secure and there has been no breach.There are no plans to evacuate Embassy Baghdad," a State Department spokesperson said.

The spokesperson added that the US Ambassador to Iraq, Matt Tueller, had been on previously scheduled personal travel and was returning to the embassy.

Earlier, Iraqi officials said the ambassador and other staff were evacuated from the embassy for their safety.

President Trump blamed Iran for "orchestrating" the attack and said he would hold Tehran responsible.

Tehran in turn hit out at the "audacity" of Washington to blame it for the violent anti-US demonstrations, warning the United States to review its policies in the region.

"The surprising audacity of American officials is so much that after killing at least 25... and violating the country's sovereignty and territorial integrity, that now... they attribute the Iraqi people's protest against their cruel acts to the Islamic Republic of Iran," said foreign ministry spokesman Abbas Mousavi.

It was the first time in years protesters have been able to reach the US embassy in Baghdad, which is sheltered behind a series of checkpoints in the high-security Green Zone.

A stream of men in military fatigues, as well as some women, marched through the checkpoints to the embassy walls with no apparent reaction from Iraqi security forces.

The demonstrators waved flags in support of the Hashed al-Shaabi, a mostly Shia network of Iraqi armed groups that has received training and weapons from powerful neighbour Iran.

They threw rocks and wrenched security cameras off the walls, ignoring calls over megaphones to leave the embassy compound.

In response, US marine guards fired an initial volley of bullets, then switched to tear gas and flash bangs to disperse the crowd.

The Hashed said at least 20 people were wounded. 

Mr Abdel Mahdi said that the crowds that had stormed the US embassy should leave the compound "immediately."

"We recall that any aggression or harassment of foreign embassies will be firmly prohibited by the security forces," Mr Abdel Mahdi's office said several hours after the attack began.

The Iraqi government had earlier announced three days of mourning for the 25 fighters killed in the US strikes. 

The United States has around 5,200 troops deployed across Iraq to train security forces and prevent any resurgence of the Islamic State jihadist group.