Then he set out to meet with religious leaders and tour holy sites on his first visit as president to a predominantly Muslim nation. Obama acknowledged still-raw tensions over the Iraq war on Monday but said Muslims worldwide have little in common with terrorists such as Al-Qaida and have much to gain in opposing them.
Reaching out, he also spoke of Muslim connections in his own background. The US president was to speak with the religious leaders and visit Istanbul's famous Blue Mosque on Tuesday, day two of his visit to this country that straddles Europe and Asia, both geographically and culturally.
A day earlier, he said in a speech to Turkey's Parliament in Ankara, "We seek broad engagement based upon mutual interests and mutual respect."
"Our partnership with the Muslim world is critical, not just in rolling back the violent ideologies that people of all faiths reject but also to strengthen opportunity for all its people," he said.
He portrayed terrorist groups as far removed from the vast majority of Muslims. Turkey has NATO's largest Army after the US, but relations between the two countries soured after the 2003 invasion of Iraq, which the Turks opposed.
Turkey barred US forces from going through its country to attack Iraq. Now, however, since Obama is withdrawing troops, Turkey has become more cooperative.
Sharing parts of its southern border with Iraq, Turkey's role in maintaining security will be pivotal after US combat troops are gone, despite the Turks' lingering problems with Kurdish militants in northern Iraq.
Turkey also has important leverage with both Afghanistan and Pakistan and has served as a broker between Israel and several Arab states. "Turkey's greatness lies in your ability to be at the center of things. This is not where East and West divide _ this is where they come together," Obama said.
He acknowledged hard feelings over Iraq. "I know that strain is shared in many places where the Muslim faith is practiced. So let me say this as clearly as I can: The United States is not and will never be at war with Islam."
Obama's visit was closely watched by an Islamic world that harbored deep distrust of his predecessor, George W Bush.
Al-Jazeera and Al-Arabiya, two of the biggest Arabic satellite channels, carried his remarks live. The president invoked his own heritage: "The United States has 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."
Obama's Kenyan father and grandfather were Muslims, and he spent time as a child in Indonesia, the country with the world's largest Muslim population.
The president spoke for about 25 minutes from a small white-marble-and-teak rostrum in the well of a vast, airy chamber packed with Turkish lawmakers in orange leather chairs. Except for a few instances of polite applause, the room was quiet during his speech.
There was a more hearty ovation toward the end when Obama said the US supports the Turkish government's battle against the Kurdish rebel group PKK, which both nations consider a terrorist group, and again when he said America was not at war with Islam.
Lawmakers also applauded when Obama said the United States supports Turkey's bid to join the European Union. Ankara and Istanbul were the final scheduled stops on Obama's eight-day international tour.
He began by attending the Group of 20 economic summit in London, then he celebrated NATO's 60th anniversary in Strasbourg, France, and visited the Czech Republic for a summit of European Union leaders. Turkey is a member of both the G-20 and NATO and is trying to get into the EU with the help of the US.
"Some people have asked me if I chose to continue my travels to Ankara and Istanbul to send a message," Obama said. "My answer is simple: Evet. Yes. Turkey is a critical ally. Turkey is an important part of Europe. And Turkey and the United States must stand together, and work together, to overcome the challenges of our time."
Obama's strong support for Turkish membership in the EU, which he reiterated on Sunday at the meeting in Prague, has chagrined some US allies, including France and Germany, which contend America has no say in the matter. Obama acknowledged the point, but said he was speaking "as a friend" of both Europe and Turkey.
"Turkey is bound to Europe by more than bridges over the Bosporus. Centuries of shared history, culture and commerce bring you together," he said. "And Turkish membership would broaden and strengthen Europe's foundation once more."
Obama began the day paying tribute to the memory of modern Turkey's founding father. "I'm honored to pay tribute to his name," Obama said at wreath-laying ceremony during a morning visit to the tomb of Mustafa Kemal Ataturk.
In his later remarks to Parliament, Obama said Ataturk's "greatest legacy is Turkey's strong and secular democracy, and that is the work that this assembly carries on today."
He also met, separately, with President Abdullah Gul and Prime Minister Recep Tayyip Erdogan, In a news conference with Gul, Obama stood by his 2008 assertion that Ottoman Turks carried out widespread killings of Armenians early in the 20th century.
But he stopped short of repeating the word "genocide" that he has used. "Well, my views are on the record and I have not changed views," Obama said.
Historians estimate that up to 1.5 million Armenians were killed by Ottoman Turks in the years leading up to and during World War I, event viewed by many scholars as the first genocide of the 20th century.
Turkey denies that the deaths constituted genocide, claiming the toll has been inflated and the casualties were victims of civil war and unrest.
On the sidelines of a dinner Monday night in Istanbul, Obama huddled with the foreign ministers of Turkey, Armenia and Switzerland, said a senior White House official. Obama commended their efforts to bring about normalized Turkish-Armenian relations and urged them to complete the talks "with dispatch," the official said.
In his speech to Parliament _ formally the Turkish Grand National Assembly _ Obama said, "History, unresolved, can be a heavy weight. Each country must work through its past. And reckoning with the past can help us seize a better future."
"I say this as the president of a country that not too long ago made it hard for someone who looks like me to vote. But it is precisely that capacity to change that enriches our countries," said America's first black president.
Turkey maintains a small military force in Afghanistan, part of the NATO contingent working with US troops to beat back the resurgent Taliban and deny Al-Qaida a safe haven along lawless stretches of the Afghan-Pakistan border.
Turkey's participation carries enormous symbolic importance to the Muslim world. It has offered to help the US train and support Afghan security forces. In his news conference with Gul, Obama addressed the rift in US and Turkish relations over Iraq.
"I do not think they ever deteriorated so far that we ceased to be friends and allies. What I hope to do is build on what is already a strong foundation," he said.