Iraqi MPs have passed a resolution calling for foreign troops to leave the country after the US killed top Iranian general Qasem Soleimani in a drone strike at Baghdad airport last week.
Parliament also called for a formal complaint to be made at the UN about US “violations” of Iraqi sovereignty.
Some 5,000 US soldiers are in Iraq as part of the international coalition against the Islamic State (IS) group.
The coalition paused operations against IS in Iraq just before Sunday’s vote.
It said it was doing so to enable its forces to concentrate on protecting US, UK and other troops at bases in Iraq.
Soleimani’s killing marks a major escalation in tensions between Washington and Tehran.
Under his leadership, Iran had bolstered Hezbollah in Lebanon and other pro-Iranian militant groups, expanded its military presence in Iraq and Syria and orchestrated Syria’s offensive against rebel groups in the country’s long civil war.
Iraq finds itself in a difficult position as an ally both of neighbouring Iran, which is demanding revenge for Soleimani’s assassination on Iraqi soil, and of the US.
The Baghdad government sees the killing of Soleimani as a violation of the terms of the coalition’s presence.
Meanwhile, there are concerns that parts of Iraq’s population sympathetic to Iran have been alienated by the killing, and that pro-Iranian militant groups may seek revenge.
The non-binding resolution was passed by the Iraqi parliament after the caretaker Prime Minister, Adel Abdul Mahdi, called for an end to the foreign military presence in a speech to MPs.
The resolution calls on the government to revoke its request for assistance from the international coalition fighting IS due to “the end of military operations in Iraq and the achievement of victory”.
It says “the Iraqi government must work to end the presence of any foreign troops on Iraqi soil and prohibit them from using its land, airspace or water for any reason”.
Furthermore, the government must file a formal complaint to the UN against the US “for its serious violations and breaches of Iraqi sovereignty and security”.
Ahead of the vote, the prime minister said the US military presence in the country should be ended as soon as possible.
Ending the US military presence in Iraq was “better for reorganising healthier and correct relationships with the US and the rest of the states”, Abdul Mahdi said.
How dangerous is the situation?
Operation Inherent Resolve, as the international coalition is formally known, announced it was halting operations against IS in order to protect US, UK and other foreign troops based in Iraq.
It pointed to repeated rocket attacks over the last two months which it blamed on the Iranian-backed Kataib Hezbollah group, whose leader Abu Mahdi al-Muhandis was killed along with Soleimani.
“We remain resolute as partners of the Government of Iraq and the Iraqi people that have welcomed us into their country to help defeat ISIS [IS],” it said.
Earlier, the US advised its citizens to leave Iraq and deployed an extra 3,000 military personnel to the Middle East.
President Donald Trump has starkly warned Iran that any revenge attack on its citizens or assets will be met with American retaliation.
Analysts say Iran could deploy cyber-attacks against the US, or attempt to strike US military targets or interests in the Middle East.