Obama, in a speech delivered to Israeli university students at the International Convention Center in Jerusalem, said he recognizes the difficulty in the resolving issues between Israelis and Palestinians, but he said peace "is the only path to true security."
"Given the demographics west of the Jordan River, the only way for Israel to endure and thrive as a Jewish and democratic state is through the realization of an independent and viable Palestine," Obama said.
"Given the frustration in the international community, Israel must reverse an undertow of isolation. And given the march of technology, the only way to truly protect the Israeli people is through the absence of war -- because no wall is high enough and no Iron Dome is strong enough, to stop every enemy from inflicting harm."
Obama said, "The Palestinian people's right to self-determination and justice must also be recognized."
"Put yourself in their shoes -- look at the world through their eyes. It is not fair that a Palestinian child cannot grow up in a state of her own, and lives with the presence of a foreign army that controls the movements of her parents every single day.
"Just as Israelis built a state in their homeland, Palestinians have a right to be a free people in their own land," he said.
The speech came after Obama's meeting Thursday with Palestinian Authority President Mahmoud Abbas in Ramallah, where he urged Palestinian leaders to resume peace talks with Israel, despite ongoing Israeli settlement building.
Obama, at a news conference with Abbas, reiterated the commitment of the United States to "an independent and sovereign state of Palestine."
"We will continue to look for steps that both Israelis and Palestinians can take to build the trust and the confidence upon lasting peace will depend," he said. "We cannot give up on the search for peace. Too much is at stake."
Obama called for direct negotiations between Israelis and Palestinians.
"There is no shortcut to a sustainable solution," he said.
"The Palestinian people deserve an end to occupation and the daily indignities that come with it," Obama said. "Palestinians deserve a state of their own."
Obama's arrival in Ramallah came hours after rockets fired from Gaza landed in the Israeli border city of Sderot. He condemned the attack, saying it is a violation of the cease-fire that protects both Israelis and Palestinians -- "a violation that Hamas has a responsibility to prevent."
He accused Hamas, which rules Gaza but is considered a terrorist organization by the United States, of caring "more about enforcing its own rigid dogmas than allowing Palestinians to live freely."
Following the news conference, Obama visited a youth center with PA Prime Minister Salam Fayyad. Events included a dance performance and a roundtable discussion with Palestinian youth.
During a state dinner at the home of Israeli President Shimon Peres, Obama was presented with Israel's Presidential Medal of Distinction, which he accepted "on behalf of the American people."
Referring to Peres' role in the formation of Israel, Obama recalled the names of previous Israeli prime ministers, including David Ben Gurion, Golda Meir, Menachim Begin and Yitzhak Rabin -- "these giants have left us. But you are with us still, a founding father in our midst," Obama told Peres.
Speaking of prospects for the peace process, Obama said, "All things are possible, even those things that in moment of darkness and doubt may seem elusive."