ISTANBUL, Turkey -- U.S. President Barack Obama, speaking Tuesday to about 100 students in Istanbul, said he was committed to rebuilding a bruised U.S.-Turkey relationship.

"I am personally committed to a new chapter of American engagement," Obama said during a town hall meeting at Tophane Cultural Center. "We can't afford to talk past one another, to focus only on our differences or to let the walls of mistrust go up around us."

Noting the long history of partnership between the two countries, Obama acknowledged: "I know there have been some difficulties in recent years. In some ways, that foundation has been weakening. ... So I came here to renew that foundation and to build on it."

In his opening remarks, Obama said he counting on young people "to help shape a more peaceful and prosperous future."

"Already, this generation, your generation, has come of age in a world that's been marked by change that's both dramatic and difficult," he said. "While you are empowered through unprecedented access to information and invention, you're also confronted with big challenges ... ."

Obama fielded questions from students including ones on the U.S. position on climate change, its support for Turkey's bid to join the European Union and how his policies are different from his predecessor, former President George W. Bush.

Obama also met with religious leaders and toured the Hagia Sophia and the Blue Mosque with Turkish Prime Minister Recep Tayyip Erdogan. After leaving Istanbul, Obama made an unannounced visit to Baghdad.