image copyrightAnadolu Agencyimage captionIraq's prime minister says there is no need for any foreign combat forces on Iraqi soil
President Joe Biden has said US combat forces will leave Iraq by the end of this year, though troops will continue to train and advise the Iraqi military.
The announcement came after Mr Biden held talks with Iraqi Prime Minister Mustafa al-Kadhimi at the White House.
There are currently 2,500 US troops in Iraq helping local forces counter what remains of the Islamic State group.
Numbers of US troops are likely to stay the same but the move is being seen as an attempt to help the Iraqi PM.
The US presence in Iraq has become a major issue since top Iranian general Qasem Soleimani and the leader of an Iran-backed Shia Muslim militia were killed in a US drone strike in the capital Baghdad last year.
Political parties aligned to Iran have demanded the withdrawal of all forces from the US-led global coalition against IS, despite the continuing threat posed by the Sunni jihadist group.
Shia militias have meanwhile been accused by the US of carrying out hundreds of rocket, mortar and drone attacks on Iraqi military bases that host coalition forces in an apparent attempt to pressure them to leave.
For the US president, the announcement marks the end of another war that began under former President George W Bush. This year he said US troops would leave Afghanistan.
- Iraqis suffer as US-Iran shadow war shifts gear
Speaking at the White House, Mr Biden told his Iraqi counterpart "our counter-terrorism co-operation will continue even as we shift to this new phase."
Mr Kadhimi responded: "Today our relationship is stronger than ever. Our co-operation is for the economy, the environment, health, education, culture and more." He has insisted no foreign combat troops are needed in Iraq.
media captionWho was Qasem Soleimani?
US-led forces invaded Iraq in 2003 to overthrow President Saddam Hussein and eliminate weapons of mass destruction that turned out not to exist.
Then President George W Bush promised a "free and peaceful Iraq", but it was engulfed by a bloody sectarian insurgency.
US combat troops eventually withdrew in 2011. However, they returned at the request of the Iraqi government three years later, when IS militants overran large parts of the country.
Following the military defeat of IS in Iraq at the end of 2017, US forces remained to help prevent a resurgence of the group.
"Our role in Iraq will be dealing with being available to continue to train, to assist, to help and deal with ISIS as it arrives," Mr Biden added at the meeting.
"But we're not going to be, by the end of the year, in a combat mission."
Ever since Iran's Islamic Revolution in 1979 it has been trying to evict US forces from its neighbourhood and become the premier power in the region.
It has had little success in the Arab Gulf states where mistrust of Tehran runs deep and where the US military has facilities in all six countries.
But the US-led toppling of the Saddam Hussein regime in Iraq removed the most effective obstacle to Iranian expansion, and Tehran has not passed up on the opportunity since then. It has successfully inserted its Shia militias into the fabric of Iraq's security establishment, and its allies have a powerful voice in parliament.
Syria's civil war has opened the door for a major Iranian military presence there, while next door in Lebanon Iran's ally Hezbollah has become the most potent force in the country.
Iran is playing the long game. Its leaders hope that if it keeps up the pressure, both overt and covert, it will eventually make the Middle East a region not worth America's effort to stay engaged in, militarily.
Hence the frequent rocket attacks on US bases and Iran's support for civil protest calling for US troops to leave.
An agreement that sees the end of US combat operations in Iraq will be seen by many in Tehran as a step in the right direction.
Read more from Frank on why Iran, and not IS, stands to gain from the US move