Baghdad: The US military's withdrawal from Iraq at the end of the year is a "historic occasion" that will transform relations between the two countries, Prime Minister Nuri al-Maliki said on Saturday.

His remarks came a day after US President Barack Obama said that all American troops will leave Iraq by the end of 2011, ending a war which created deep political divides and estranged the United States from allies.

"The withdrawal is a historic occasion for the Iraqi people and the armed forces, because it is a commitment to withdraw all US forces," Maliki told reporters in Baghdad's heavily-guarded Green Zone.

"Our forces have become able to control the security situation. With the withdrawal, we (Iraq and the US) will turn a page that was dominated by military (relations) and start a new stage built on diplomatic cooperation."

The decision 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.

Obama's predecessor George W Bush ordered the Iraq invasion in 2003, arguing its then leader Saddam Hussein was endangering the world with weapons of mass destruction. After Saddam was toppled, such arms were never found.

On the sidelines of a World Economic Forum in Jordan, Iraqi government spokesman Ali al-Dabbagh told reporters that Baghdad was ready to assume responsibility for its security.

"Security issues are Iraq's responsibility. It is a big challenge that we accept. We cannot keep foreign troops in our country," he said.

"Iraq is still facing certain dangers but, God willing, Iraqi forces are capable of tackling them without the help of foreign troops," the spokesman said.