President Obama confirmed plans today to have all U.S. troops out of Iraq by Jan. 1, formally ending the war that began in the spring of 2003 and has taken more than 4,400 American lives.

"After nearly nine years, America's war in Iraq will be over," Obama said at the White House, adding that most U.S. troops will be "home for the holidays."

Obama noted that he pledged to end the Iraq War during his 2008 presidential campaign.

"The coming months will be another season of homecomings," Obama said. "Across America, our servicemen and -women will be reunited with their families. ... This December will be a time to reflect on all that we've been through in this war."

The president spoke in the White House briefing room after holding a secure video conference with Iraq Prime Minister Nouri al-Maliki. Obama said he and the Iraqi leader are in "full agreement about how to move forward."

The U.S. has had a long-standing agreement to withdraw all combat troops from Iraq by the end of this year, but officials from both countries had discussed maintaining a U.S. residual force to train Iraqi forces.

But the U.S. eventually balked at maintaining a residual force because Iraq has refused to grant American troops legal immunity in Iraqi courts.

Obama praised the U.S. troops for their efforts in Iraq, saying they will leave "with their heads held high, proud of their success, and knowing that the American people stand united in our support for our troops."

He also pledged assistance and "a strong and enduring partnership" with the government in Iraq.

"With our diplomats and civilian advisers in the lead, we will help Iraqis strengthen institutions that are just, representative and accountable," Obama said. "We'll build new ties of trade and of commerce, culture and education that unleash the potential of the Iraqi people."

The president also appeared to deliver a warning Iran, which he has accused of helping insurgents in Iraq. "We'll partner with an Iraq that contributes to regional security and peace, just as we insist that other nations respect Iraq's sovereignty," Obama said.

The announcement came a day after the death of former Libya dictator Moammar Gadhafi, bringing that conflict to an end.

The president also noted he is planning to withdraw U.S. troops from Afghanistan, a process hoped to be completed by 2014.

Obama inherited the Iraq and Afghanistan wars from predecessor George W. Bush.

"I would note that the end of war in Iraq reflects a larger transition," Obama said. "The tide of war is receding."