The US military officially ended its war in Iraq on Thursday, packing up a military flag at a ceremony attended by US defence secretary Leon Panetta, nearly nine years after the invasion that ousted Saddam Hussein.
The last 4,000 American troops will withdraw by the end of the year, leaving Iraq still tackling a weakened but stubborn insurgency, sectarian tensions and political uncertainty.
"After a lot of blood spilled by Iraqis and Americans, the mission of an Iraq that could govern and secure itself has become real," Panetta said at the ceremony.
At the end of the ceremony, a US soldier rolled up the flag for American forces in Iraq and slipped it into his camouflage-coloured sleeve.
President Barack Obama, who made an election promise to bring troops home, told Iraqi Prime Minister Nuri al-Maliki that US would remain a loyal partner after the last troops roll across the Kuwaiti border.
Iraq's Shi'ite leadership sees the withdrawal as a new start for the country's sovereignty.