Protesters who have been demonstrating outside the US embassy in Iraq for a second day have withdrawn from the area after a tense standoff.
On Tuesday, the embassy was attacked by a crowd angered by US air strikes targeting an Iran-backed militia.
Clashes continued on Wednesday as demonstrators hurled stones while US forces fired tear gas.
The hostilities came amid escalating tension between the US and Iran - the two main Iraqi government sponsors.
Tuesday's attack - which sparked a war of words between US President Donald Trump and Iran's Supreme Leader Ayatollah Ali Khamenei - had threatened to escalate, with the US defence secretary announcing the deployment of additional troops to the region.
But by Wednesday evening, the Iraqi government announced that all groups had withdrawn from the perimeter of the US embassy in Baghdad following an appeal for calm.
A small group of protesters however began to set up a camp in front of a nearby hotel.
President Trump has threatened Iran after blaming it for Tuesday's attack, in which no US personnel were injured. Mr Trump tweeted that Iran "will pay a very big price" for any damage or loss of life. "This is not a warning, it is a threat," he said.
But Iran's Supreme Leader Ayatollah Ali Khamenei responded by saying the US "can't do a damn thing". Anti-American sentiment was widespread in Iraq, he added.
Tehran has denied that it orchestrated the protests at the Baghdad embassy.
....Iran will be held fully responsible for lives lost, or damage incurred, at any of our facilities. They will pay a very BIG PRICE! This is not a Warning, it is a Threat. Happy New Year!— Donald J. Trump (@realDonaldTrump) December 31, 2019
The embassy is one of the largest US diplomatic missions in the world and one of the most heavily guarded.
Currently, there are about 5,000 US troops in Iraq involved in anti-Islamic State operations and training missions with the Iraqi security forces.
The protests starkly illustrate the tenuous and difficult nature of the US relationship with Iraq. The question now is whether this relationship is tenable and, if so, for how long?
The struggle against the Islamic State (IS) group obscured the basic geometry of the Iraqi government's position. It needed the US military presence to train and assist its forces. But its Shia government was closely allied with Tehran.
So developed a curious triangular relationship, with the US and Iran deeply suspicious of each other's motives and eager that their rival's influence should be reduced. Iraq steers a sometimes bumpy course between them that has got bumpier in recent weeks following a wave of domestic protest inside Iraq at the government's incompetence, which has an element of hostility to Iranian meddling too.
Iran meanwhile has built up its links to Shia militias in the country, one of which is judged by the Americans to have been responsible for the rocket attacks against its bases - hence the US air strikes. The Americans see Tehran as behind the attacks and want the Iraqi authorities to ensure the safety of US facilities.
But with the Trump administration sending out conflicting signals about its future role in the region; in part a desire to limit its involvement and in part a message of deterrence against Tehran - it is easy to be confused. And amid this confusion the danger of a direct clash between Washington and Tehran only grows.
What sparked the protests?
Tuesday's protest took place after funerals were held for militia fighters killed in US strikes.
The militia was an Iranian-backed force, the Kataib Hezbollah militia in western Iraq and eastern Syria.
At least 25 fighters died in the US bombing of their bases on Sunday, which Washington said was a retaliation for the death of an American civilian worker killed during a rocket attack on an Iraqi military base.
In response, an angry crowd breached a reception area in the US embassy compound, leading US troops to fire teargas to repel them.
"The United States will protect our people and interests anywhere they are found around the world," he wrote in a tweet.
Why did the US target Kataib Hezbollah?
The US said the militia had carried out repeated attacks on Iraqi bases that host US-led coalition forces fighting the Islamic State group.
In response, it added, US forces conducted "precision defensive strikes" on Sunday against five facilities, including weapon stores and command and control locations, that would degrade its ability to conduct future attacks.
Since 2009, the US has designated Kataib Hezbollah as a terrorist organisation and listed its leader Abu Mahdi al-Muhandis as a "global terrorist".