US forces will lower the flag in Iraq on Thursday, in a formal ceremony ahead of their withdrawal from the country nearly nine years after the controversial invasion to topple Saddam Hussein.
The ceremony marking the closure of the US military's headquarters in Iraq comes after US President Barack Obama hailed the "extraordinary achievement" of a war in a speech to welcome home some of the troops.
The remaining several thousand US soldiers in Iraq will depart in the coming days, at which point almost no more American troops will remain in a country where there were once nearly 170,000 personnel on more than 500 bases.
The withdrawal will end a war that left tens of thousands of Iraqis and nearly 4,500 American soldiers dead, many more wounded, and 1.75 million Iraqis displaced, after the 2003 US-led invasion unleashed brutal sectarian fighting.
In an aircraft hangar at Fort Bragg in North Carolina, Obama was cheered by 82nd Airborne Division troops as honoured nearly nine years of "bleeding and building."
"Tomorrow (Thursday), the colors of United States Forces Iraq, the colours you fought under, will be formally cased in a ceremony in Baghdad," he said.
"One of the most extraordinary chapters in the history of the American military will come to an end. Iraq's future will be in the hands of its people. America's war in Iraq will be over."
In Afghanistan, US Defence Secretary Leon Panetta said he would be heading to Iraq to attend the ceremony to "encase the flag and mark the end of the combat effort that we've made as a country."
"Our mission there was to establish an Iraq that would be sovereign and independent, that would be able to govern and secure itself. And I think we've done a great job there in trying to achieve that mission," he told US soldiers.
"It doesn't mean they're not gonna face challenges in the future. They're gonna face terrorism, they're gonna face challenges from those that will want to divide their country, they'll face challenges from just the test of ... a new democracy and trying to make it work," said Panetta.
But "the fact is that we've given them the opportunity to be able to succeed."
The war to oust Saddam was launched in March 2003 with a massive "shock and awe" campaign, followed by eight-plus years in which a US-led coalition sought not only had to rebuild the Iraqi military from the ground up, but also to establish a new political system.
Iraq now has a parliament and regular elections, and is ruled by a Shiite-led government that replaced Saddam's Sunni-dominated regime.
The pullout, enshrined in a 2008 bilateral pact, is the latest stage in the changing US role in Iraq, from 2003-2004 when American officials ran the country to 2009 when the United Nations mandate ended, and last summer when Washington officially ended combat operations here.