WASHINGTON - U.S. President Barack Obama heralded the end of the divisive Iraq war Monday, and warned Iraq's neighbours that the United States would remain a major player in the region even as it brings its troops home.

"Our strong presence in the Middle East endures," Obama said. "And the United States will never waiver in the defence of our allies, our partners and our interests."

Speaking after a morning of meetings with Iraqi Prime Minister Nouri al-Maliki, Obama said other nations must not interfere with Iraq's sovereignty. While he stopped short of mentioning any countries by name, U.S. officials are closely watching how neighboring Iran may seek to influence Baghdad after U.S. troops withdraw.

Early signs of how Iraq may orient itself could come from how it handles the troubles in Syria, where the United Nations says 4,000 people have been killed in a government crackdown on protesters. While Obama has called for Syrian President Bashar Assad to step down, Iraq has been more circumspect, with al-Maliki warning of civil war if Assad falls and abstaining from Arab League votes suspending Syria's membership and imposing sanctions. Those positions align Iraq more closely with Iran, a key Syrian ally.

Obama said he and al-Maliki were both deeply concerned by the Syrian government's assault on its own people. And Obama said he was confident that the Iraqi leader's approach to dealing with Syria was based on his own nation's interests.

"Even if there are tactical disagreements I have no doubt those decisions are made based on what's best for Iraq, not considerations of what Iran would like to see," Obama said.

Al-Maliki's trip to Washington came as the last American troops were preparing to leave Iraq ahead of a Dec. 31 deadline. Just 6,000 U.S. forces remain, down from a high of 170,000 at the war's peak in 2007.

About 1 million U.S. troops have cycled through Iraq since the war began nearly nine years ago. Obama said the military can officially withdraw from Iraq "with honour and with their heads held high."

Later Monday, Obama and al-Maliki will remember the nearly 4,500 Americans who lost their lives in the war during a wreath laying ceremony at Arlington National Cemetery.

Mindful of what he called America's "enormous investment of blood and treasure," Obama said the U.S. would seek to build a comprehensive relationship with Iraq, with the goal of making the war-weary nation a model of democracy in the region.

Al-Maliki said Iraq will still need U.S. help on security issues, combating terrorism, and training and equipping the Iraqi military, as well as other areas including education and developing its wealth. He said there were "very high aspirations" for the relationship between the two nations."

The U.S. will maintain a significant presence in Iraq, with about 16,000 people working at the U.S. embassy in Baghdad. The size of the embassy has been a point of contention among some in Iraq, who see the massive mission as another way for the U.S. to wield influence in their country.

Obama defended the size of the embassy, saying there were special security needs required in a country fresh off a protracted war.

"As president of the United States I have to make sure that anybody who is in Iraq trying to help Iraqi people is protected," he said. "I'm putting civilians in the field. I want to make sure that they come home, because they are not soldiers."

The White House has been eager to promote the end of the Iraq war as a promise kept for Obama. He was an early opponent of conflict, and pledged to bring the war to a close when he ran for the White House.

Obama thanked service members and their families for their sacrifices when he attended the annual Army-Navy football game Saturday, and will mark the milestone again on Wednesday when he speaks to troops at Fort Bragg in North Carolina.