A surprise visit by President George Bush to Iraq has been overshadowed by an incident in which two shoes were thrown at him during a news conference.
An Iraqi journalist was wrestled to the floor by security guards after he called Mr Bush "a dog" and threw his footwear, just missing the president.
Using the soles of shoes in such a way is considered the ultimate insult in Arab culture.
Mr Bush dodged the shoes and downplayed the incident, saying that it was a sign of a free society.
During the trip, Mr Bush and Iraqi Prime Minister Nouri Maliki signed a security agreement between their countries.
The pact calls for US troops to leave Iraq in 2011 - eight years after the 2003 invasion that has in part defined the Bush presidency.
Speaking about five weeks before he hands over power to Barack Obama, Mr Bush said the war in Iraq was not over and more work remained to be done.
The visit came a day after US Defence Secretary Robert Gates told US troops the Iraq mission was in its "endgame".
In the middle of the news conference with Mr Maliki, a reporter stood up and shouted "this is a goodbye kiss from the Iraqi people, dog," before hurtling his shoes at Mr Bush, narrowly missing him.
The shoe thrower was taken away by security guards and the news conference continued.
Correspondents called it a symbolic incident. Iraqis threw shoes and used them to beat Saddam Hussein's statue in Baghdad after his overthrow.
Mr Bush leaves the White House on 20 January. He said in a recent interview with ABC News that the biggest regret of his presidency was the false intelligence that Iraq had weapons of mass destruction.
Finding such weapons was one of the key justifications for the invasion. None was found.
Mr Obama has promised to bring US troops home from Iraq in about a year.
More than 4,200 US troops and tens of thousands of Iraqi civilians and security personnel have been killed since the invasion in 2003.
There are 149,000 US soldiers in Iraq, down from last year's peak of 170,000 after extra troops were sent to deal with a worsening security situation.
Mr Bush arrived at Baghdad International Airport on Sunday afternoon after leaving Washington on Saturday night departure aboard Air Force One.