US President Joe Biden and Iraqi Prime Minister Mustafa Al Kadhimi on Monday sealed an agreement formally ending the US combat mission in Iraq by the end of 2021, more than 18 years after American troops were sent to the country.
Coupled with Mr Biden's decision to withdraw the last American forces in Afghanistan by the end of August, he is completing US combat missions in the two wars that then-president George W Bush began under his watch.
Mr Biden and Mr Al Kadhimi met in the Oval Office for their first direct talks as part of a strategic dialogue between the US and Iraq.
"Our role in Iraq will be ... to be available, to continue to train, to assist, to help and to deal with ISIS as it arises but we’re not going to be, by the end of the year, in a combat zone," Mr Biden said after the meeting.
There are 2,500 US troops in Iraq to battle the remnants of ISIS. The US role in Iraq will shift entirely to training and advising the Iraqi military.
The shift is not expected to have a major impact because the US has already moved its focus towards training Iraqi troops.
A US-led coalition invaded Iraq in March 2003 based on charges that then-Iraqi leader Saddam Hussein's government had weapons of mass destruction. Saddam was ousted from power, but such weapons were never found.
In recent years the US mission was dominated by helping to defeat ISIS militants in Iraq and Syria.
"Nobody is going to declare mission accomplished. The goal is the enduring defeat of ISIS," a senior administration official said before Mr Al Kadhimi's visit.
The reference recalled the large "Mission Accomplished" banner on the USS Abraham Lincoln aircraft carrier where Mr Bush declared major combat operations were over in Iraq on May 1, 2003.
"If you look to where we were, where we had Apache helicopters in combat, when we had US special forces doing regular operations, it's a significant evolution," the official said.
"So by the end of the year we think we'll be in a good place to really formally move into an advisory and capacity-building role."
US diplomats and troops in Iraq and Syria were attacked in three rocket and drone strikes this month. Analysts believed the attacks were part of a campaign by Iranian-backed militias.
The senior administration official would not say how many US troops would remain in Iraq for advising and training.
Mr Al Kadhimi is regarded as friendly to the US and has tried to check the power of Iran-aligned militias.
But his government condemned a US air raid against Iran-backed fighters along its border with Syria in late June, calling it a breach of Iraqi sovereignty.
The US-Iraqi statement is expected to also detail non-military agreements related to health, energy and other matters.
The US plans to provide Iraq with 500,000 doses of the Pfizer-BioNTech Covid-19 vaccine under the global Covax vaccine-sharing programme. Mr Biden said the doses should arrive in a couple of weeks.
The US will also provide $5.2 million to help fund a UN mission to monitor October elections in Iraq.
"We're looking forward to seeing an election in October," Mr Biden said.
The White House said Mr Biden was joined by several prominent members of his administration, including Secretary of State Antony Blinken, National Security Adviser Jake Sullivan and White House Middle East co-ordinator Brett McGurk.
Mr Al Kadhimi’s delegation included Deputy Prime Minister for Foreign Affairs and Minister of Foreign Affairs Fuad Hussein, Defence Minister Jumaah Enad and Raid Juhi, the prime minister’s chief of staff, as well as Iraq’s ambassador to the US, Fareed Yasseen.