United States President Barack Obama has said on a surprise visit to Iraq that the next 18 months may be "critical" and told the war-torn country that it will soon have to look after itself.
Mr Obama, who has called for an end to US combat operations in Iraq by August next year, flew into Baghdad on his first trip since taking office three months ago.
He told an audience of US troops stationed near Baghdad that it was time to transfer control to the Iraqis.
Mr Obama, who opposed the 2003 invasion of Iraq ordered by his predecessor George Bush, has used his debut overseas tour to reach out to the Islamic world and attempt to restore the US' battered image abroad.
Mr Obama's visit to Iraq followed a tour of Europe that focused on the global economic crisis and also sought better relations with Muslims.
He spent his last day in Istanbul, where he held discussions with students. He earlier met religious leaders and visited the Blue Mosque.
His chief political adviser says the trip has been "enormously productive".
On Monday, Mr Obama said the US was "not at war with Islam" and offered partnership to the Muslim world.
Addressing the Turkish parliament, he spoke of his deep appreciation for the Islamic faith and said the US had been enriched by Muslim Americans.
"Many other Americans have Muslims in their family, or have lived in a Muslim-majority country - I know, because I am one of them," he said.
"And when people look back on this time, let it be said of America that we extended the hand of friendship."
The BBC reports Mr Obama's remarks went further than expected but that questions remain over whether his warm words will lead to better relations.
Mr Obama also held an informal meeting with Turkish students. He told them that he understood the frustrations that recent US actions have caused Muslims, and wanted to turn the page.
Earlier, he met Armenian Patriarch Mesrob II, Istanbul Chief Rabbi Isak Haleva, the senior Islamic official in Istanbul, Mufti Mustafa Cagrici, and Syriac Orthodox Archbishop Yusuf Cetin.
He later went on a tour accompanied by Turkish Prime Minister Recep Tayyip Erdogan of Istanbul's famous Blue Mosque and the Hagia Sophia, a museum that was first a Byzantine basilica and then a mosque.