Obama: I am committed to a new chapter in American engagement
US President Barack Obama has ended his European tour by saying he is committed to opening a "new chapter in American engagement" with the Muslim world.
In an address to students in Istanbul, he said Americans and Muslims could no longer "afford to talk past one another and focus only on our differences".
Mr Obama earlier met religious leaders and visited the famous Blue Mosque.
On Monday, the president told the Turkish parliament that the US was "not and will never be at war with Islam".
Mr Obama spoke too 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," he added.
Correspondents say Mr Obama's remarks went further than expected but that questions remain over whether his warm words will lead to better relations.
After three international summits and 14 bilateral meetings, President Obama later left Turkey - and went to Iraq on a surprise visit.
He began the day by meeting Muslim, Jewish and Christian leaders at his hotel in Istanbul, and by visiting the city's famous Blue Mosque and the Hagia Sophia, a museum that was previously a Byzantine church and then a mosque.
Mr Obama then held an informal meeting with students, during which he said he wanted to rebuild the relationship between the US and the Muslim world.
"I believe we can have a dialogue that's open, vibrant and grounded in respect. And I want you to know that I am personally committed to a new chapter in American engagement," he said.
"We can't afford to talk past one another and focus only on our differences, or to let the walls of mistrust go up around us."
The president said part of that process involved giving people a better sense of the US and rejected the stereotype that his country was selfish and crass.
"I'm here to tell you that it's not the country I know and not the country I love," he added.
Barack Obama was shown around Istanbul by Turkish PM Erdogan
Mr Obama told the assembled students that one day, it would be their generation that held the world's future in its hands.
"The world will be what you make it. You can choose to build new bridges instead of building new walls. You can choose to put aside long-standing divisions in pursuit of lasting peace. You can choose to advance a prosperity that is shared by all people and not just the wealthy few," he said.
"And I want you to know that in these endeavours you will find a partner and a supporter and a friend in the United States of America."
Earlier, David Axelrod, the president's closest political aide, said there had been tangible benefits already from the tour of Europe, in particular with pledges of support for the war on Afghanistan, reform of the global financial system, and the restarting of arms talks with Russia.
He said the visit had also been a great step forward in establishing personal relationships with leaders who will be important in promoting world security.
Mr Axelrod referred as well to a dialogue Mr Obama had begun with the people of Europe.
"You plant, you cultivate, you harvest," he said. "Over time, the seeds that were planted here are going to be very, very valuable."