(CNN) -- President Barack Obama said Friday that America's long war in Iraq will end by the end of the year and announced that almost all U.S. troops will come home.
"After nearly nine years, America's war in Iraqi will be over," Obama said. "The coming months will be a season of homecomings. Our troops in Iraq will definitely be home for the holidays."
Of the 39,000 troops in Iraq, only about 150, a negligible force, will remain to assist in arms sales.
Obama said the end of the war was a campaign pledge he has made good on.
The new partnership with Iraq will be "strong and enduring," Obama said.
A current Status of Force Agreement called for U.S. forces to leave Iraq by the end of 2011 but lengthy negotiations had given rise to the expectation that an American presence would continue beyond that date.
The United States had expected that some of the roughly 40,000 Americans in Iraq would remain there to aid in training and security.
But the talks broke down over the prickly issue of legal immunity for U.S. troops in Iraq, a senior U.S. military official with direct knowledge of the discussions told CNN this month.
Secretary of Defense Leon Panetta and other top brass have repeatedly said that any deal to keep U.S. troops in Iraq beyond the withdrawal deadline would require a guarantee of legal protection for American soldiers.
But the Iraqis refused to agree to that, opening up the prospect of Americans being tried in Iraqi courts and subjected to Iraqi punishment.
The negotiations were strained following WikiLeaks' release of a diplomatic cable that alleged Iraqi civilians, including children, were killed in a 2006 raid by American troops rather than in an airstrike as initially reported by the U.S. military.
U.S. troops have already started the drawdown: A brigade from Fort Bliss, Texas, that was originally scheduled to be among the very last to leave Iraq was being pulled out of the country months ahead of its planned departure, military officials said last week.
CNN's Chris Lawrence contributed to this report.