Barack Obama has told Palestinians the United States is "deeply committed to a sovereign and independent Palestinian state" but he would not press the Israelis into freezing settlement building in the West Bank as a pre-condition to fresh talks between the two sides.
The realisation of an independent Palestine is the "only way" for Israel to "endure and thrive", he said during an impassioned speech to university students in Jerusalem.
Speaking on the second day of his state visit, Obama said Israelis must recognise that Jewish settlement activity in occupied territory hinders prospects for peace and that the Palestinians were deserving of their own state, a message that drew huge applause from the audience.
"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 realisation of an independent and viable Palestine," Obama said.
"It is not fair that a Palestinian child cannot grow up in a state of her own. The Palestinians also deserve justice. Put yourself in their position; see the world through their eyes."
While his set-piece speech was heartily received, he was to leave Israel after his three-day visit without any concrete proposals on how to move the peace process forward.
Earlier, Obama told Palestinians he would not push the Israelis into a new settlement freeze, a move the Palestinians have previously set as a pre-condition to resume talks.
The last peace talks between the two sides came in late 2010 when Israeli Prime Minister Benjamin Netanyahu agreed to a freeze on the building of settlements but broke down when he later ordered building to resume.
Instead, during a joint press conference in Ramallah, Obama pressed Palestinian President Mahmoud Abbas to drop his demand for a freeze on settlements.
He said he had told Abbas "that if the expectation is that we can only have direct negotiations when everything is settled ahead of time, then there is no point for negotiations".
But Abbas attacked settlement building - considered illegal under international law - in his response to reporters' questions. "Everybody considers settlements more than a hurdle toward a two-state solution," he said. "Settlements are illegal, countless UN resolutions call for an end of settlements, we don't claim anything illegitimate."
With the Housing Minister, Defence Minister, deputy Defence Minister and likely Foreign Minister in the new Israeli Government all settlers, some Palestinians fear it will have a green light to continue building.
About 150 Palestinian demonstrators gathered in Ramallah to protest against Obama's visit. Unlike Jerusalem, there are few American flags flying in Ramallah. Demonstrators held up shoes - an insult in Arab culture - and called for Obama to leave Palestine.
In Rafah, a city in southern Gaza, which borders Egypt, protesters burnt an effigy of Obama.
Gaza's Hamas Prime Minister, Ismail Haniyeh, said he does not expect Obama's visit to change the situation for Palestinians.
Barack Obama was heckled by a man shouting in Hebrew during his address to university students in Jerusalem.
The man was apparently talking about Jonathan Pollard, 58, who is serving a life term in a North Carolina prison after pleading guilty in 1987 to spying for Israel, gathering information during his time as a civilian intelligence officer for the United States Navy.
Israelis have asked successive US presidents to pardon Pollard for decades, with calls increasing ahead of Obama's trip to Israel.
Responding to the heckler, Obama said: "This is part of the lively debate that we talked about ... this is good."
Obama said he "wouldn't feel comfortable if I didn't have at least one heckler" but did not address the issue of Pollard's incarceration.