Iraq's parliament voted on Sunday to end foreign troop presence in the country, including thousands from the US, and to lodge a complaint with the United Nations over the killing of Qassem Suleimani, the head of Iran’s elite forces.

On Friday, regional tensions were dramatically escalated after Suleimani was killed by a US drone strike in Baghdad.

The extraordinary session on Sunday was led by departing Prime Minister Adel Abdul Mahdi, who resigned following months of anti-government protests, but is in office until a replacement has been decided on.

Parliament voted on a five-point action plan that would require the Iraqi government to end the presence of foreign troops in the country, and withdraw its request for assistance from the anti-ISIS global coalition. This would require new legislation to cancel the existing agreement.

Parliament also called on the government to ban the use of Iraqi airspace by any foreign power.

The Iraqi foreign minister has been directed to head to the UN to lodge an official complaint against the US strike.

Iraq's caretaker prime minister Adel Abdel Mahdi speaks during a ceremony in Baghdad. Mr Abdel Mahdi slammed a US strike that killed top Iraqi and Iranian commanders in Baghdad as an 'aggression' that could 'spark a devastating war'.

Around 5,200 US soldiers have been stationed across bases in the country since an invitation by the Iraqi government in 2014 to support local troops fighting ISIS.

US Secretary of State Mike Pompeo said on Fox News on Sunday that it is possible Iran will "make a mistake" and try to attack US troops in Iraq or Syria.

Mr Abdul Mahdi said asking the US forces to leave “would be the best option to establish a strong friendship with the US and other countries, based on mutual respect for sovereignty”.

The decline of ISIS, he said, removes the major reason for the presence of US forces in the country.

In attendance at the session were 173 of the 329 Iraqi MPs. It was backed by most Shiite members of parliament, who hold a majority of seats. Many Sunni and Kurdish legislators did not show up for the session, apparently because they oppose abolishing the deal.

The request for the vote was put forward on Sunday by the largest bloc in the legislature, known as Fatah, which includes leaders associated with the Iran-backed paramilitary Popular Mobilisation Forces.

Iranian intelligence officers have co-opted much of the Iraqi government’s Cabinet, leaked cables revealed last month, as protests raged across the country calling for an end to their interference.

US bases in Iraq have been threatened by pro-Tehran factions after the killing of Suleimani, the commander of Iran's Islamic Revolutionary Guards' Quds Force, and Iraqi paramilitary chief Abu Mahdi Al Muhandis.

Late on Saturday, missiles hit the Baghdad enclave where the US embassy is located and an airbase north of the capital housing US troops, prompting President Donald Trump to threaten strikes on 52 sites in Iran.

The near-simultaneous attacks seemed to be the first phase of promised retaliation for the US precision drone strike that killed Suleimani and Al Muhandis.

The head of Lebanon's Hezbollah movement, Hassan Nasrallah, called on Iraq to free itself of the US "occupation" before the vote.

The Iraqi foreign ministry also said on Sunday that it has summoned US ambassador Matthew Tueller to condemn the strikes.

"They were a blatant violation of Iraqi sovereignty," the ministry said in a statement, and "contradict the agreed-upon missions of the international coalition."

What happens next?

The bill is subject to approval by the Iraqi government and cancelling the US-Iraq agreement requires a one-year notice for withdrawal.

The US-led military coalition in Iraq announced on Sunday it is putting the fight against ISIS militants on hold to focus on protecting its troops and bases. The coalition said it is suspending the training of Iraqi forces and other operations in support of the battle against ISIS.

A pullout of US troops could cripple the fight against ISIS and allow the militants to make a comeback. It could also enable Iran to deepen its influence in Iraq.

US Senator Lindsey Graham, a member of the Senate Foreign Relations Committee, said on Fox News that the vote is “a bit concerning”.

“The Iranian government is trying to basically take over Iraq’s political system. Iran is bribing Iraqi politicians. To the Iraqi people, do not allow your politicians to turn Iraq into a proxy of Iran,” he said.

The majority of about 180 legislators present in Parliament voted in favour of the resolution. It was backed by most Shiite members of parliament, who hold a majority of seats. Many Sunni and Kurdish legislators did not show up for the session, apparently because they oppose abolishing the deal.