Iraqi Prime Minister Mustafa Al Kadhimi has warned that a US withdrawal would be "catastrophic for Iraq," after reports that the US was considering closing its embassy in Baghdad.
In the past two months, there have been more than 40 attacks on the US embassy and military bases, and on supply convoys of Iraqi contractors for Washington and its allies.
As a result, US Secretary of State Mike Pompeo threatened to close the embassy in Baghdad within weeks if Iraq failed to stop Iranian-backed militias attacking American people and posts.
Iraq had not received any such warning, and "will not accept any warnings from any country", Mr Al Kadhimi told state news channel Al Ikhbaria.
“We felt that the Americans were annoyed at the number of attacks that have targeted their diplomatic missions in Iraq and this is their right,” he said.
“There are sides who are attempting to sabotage Iraq’s relationship with the world, taking the country towards the unknown."
In recent months, rockets have repeatedly been launched across the Tigris in attacks on the heavily fortified US and foreign diplomatic compound.
But Mr Al Kadhimi said Iraq had shown its seriousness to the US about stopping the attacks and arresting the perpetrators.
“The consequences of a US withdrawal, if it would happen, would be catastrophic for Iraq, especially as it would result in an economic crisis that has never been seen before,” he said.
Washington blames Iran-backed militias for firing rockets at its embassy on a near-weekly basis for months, and for shelling Iraqi bases housing international troops, including many of the 5,000 US soldiers.
A rocket landed near Baghdad airport last week, killing three civilians and wounding two, security officials said.
The US bases its relations on its interests, Mr Al Kadhimi said, and Iraq must also ensure its interests are protected in all fields.
"We are not ashamed of any relationship that preserves the dignity of Iraq and the Iraqis,” he said.
Last week populist cleric Moqtada Al Sadr called for a joint committee to look at ways of halting attacks by militias on diplomatic outposts, which was welcomed by politicians in the country.
Mr Al Sadr, whose Mahdi Army once fought US troops in Iraq, said that “given the seriousness of the security situation that threatens the country's present and future, we find it is an urgent interest to form a committee of security, military and parliamentary nature".
He said that the aim must be to halt attacks on diplomats as it “harms Iraq's reputation in international forums.”
Mr Al Kadhimi’s remarks came as Iraqi Foreign Minister, Fuad Hussein, warned Mr Pompeo that a US pullout would not be in the interest of the Iraqi people.
“The government has taken a number of measures to halt attacks on the Green Zone and Baghdad airport,” he said, adding that there will be “positive results” seen in the near future.
Mr Pompeo said that relations between the two countries were crucial for the futures of both.