US President Barack Obama said all American troops will leave Iraq by the end of the year, ending a long war which cleaved deep political divides and estranged the United States from its allies.
The decision, announced Friday, came after Iraq failed to agree to legal immunity for a small residual force that Washington had hoped to keep in the country to train the army and counter the influence of neighboring Iran, officials said.
After nearly nine years, the deaths of more than 4,400 US troops, tens of thousands of Iraqis and the expenditure of hundreds of billions of dollars, Obama said the last American soldier would leave with his head held high.
"Today I can report that, as promised, the rest of our troops in Iraq will come home by the end of the year. After nearly nine years, America's war in Iraq will be over," Obama said at the White House.
"Our troops in Iraq will definitely be home for the holidays," said Obama, who rose to power in opposing the unpopular war and pledged as a presidential candidate to withdraw all US military personnel.
Obama's predecessor George W. Bush ordered the invasion of Iraq in 2003, arguing that its then leader Saddam Hussein was endangering the world with weapons of mass destruction programs. After Saddam was toppled, such arms were never found.
US troops soon became embroiled in a bitter insurgency, swelled by incoming Al-Qaeda fighters, and the tide of the war only turned when now retired General David Petraeus convinced Bush to mount a troop surge strategy in 2007.
Obama announced the pullout after holding a video conference with Prime Minister Nuri al-Maliki, which US officials said included a moving tribute by the Iraqi leader to American troops who died in his country.
US defense officials said talks on a future military mission had collapsed over the question of legal protections for American troops.
"That is a red line for us," said one official, who spoke on condition of anonymity."
Obama said that despite the failure, US defense officials would still seek ways to help train Iraqi forces, as they do for many other nations. And hours later, US Defense Secretary Leon Panetta confirmed such a strategy.
"Once we've completed the reduction of the combat presence, then I think we begin a process of negotiating with them," Panetta told reporters.
"We now turn our full attention to pursuing a long term strategic partnership with Iraq that's based on mutual interest and mutual respect," he added.
President Obama's announcement to bring all troops home fulfilled a central promise of his 2008 election campaign, which took place at a time when the Iraq war was still a painful fault line in US politics.
It also came after his credentials as commander-in-chief, bolstered by the killing of Osama bin Laden and top Al-Qaeda suspects, were further enhanced by the death of Moamer Kadhafi after a NATO mission in support of Libyan rebels.
But Republican presidential candidate Mitt Romney accused Obama of presiding over an "astonishing failure to secure an orderly transition in Iraq" which put at risk victories won through the sacrifice of American soldiers.
"The unavoidable question is whether this decision is the result of a naked political calculation or simply sheer ineptitude in negotiations with the Iraqi government," he said.
Republican Senator Lindsey Graham of South Carolina, one of the staunchest supporters of the war, said he feared that "this decision has set in motion events that will come back to haunt our country."
Democrats largely supported Obama's move. Senator John Kerry said Washington was fulfilling its obligations to a nation that wanted to chart its own future.
The US withdrawal provokes a number of questions about the war-ravaged country's future, including:
-- Are the Iraqi military and security forces up to the job of safeguarding security gains made over recent years?
-- How will Iran seek to expand its influence in Iraqi politics?
-- Is Iraq's fledgling political system robust enough to survive?
-- Will disputes between Kurdistan and Baghdad drive a deeper wedge between the autonomous region and the central government?
Obama administration officials declined to say whether the war had been worthwhile.
"History is going to have to judge that," said Vice President Joe Biden's national security advisor Tony Blinken, who argued that vibrant politics in Iraq would be part of the US legacy.
Maliki, who Obama has invited to the White House in December, said in a brief statement that the two leaders were on the same page on the withdrawal.
The 39,000 remaining US troops in Iraq must pull out by the end of 2011 under an accord between the two countries reached during the Bush presidency.