US President Barack Obama has appealed directly to the Israeli people to put themselves in the shoes of stateless Palestinians and recognise that Jewish settlement activity in occupied territory hurts prospects for peace.

In a showcase speech in Jerusalem to Israeli university students, Mr Obama coupled his plea with an acknowledgement of the Jewish state's security concerns.

But he urged Israel's younger generation to demand that their politicians take risks for peace in an address interrupted frequently by applause, including a standing ovation for the president during a brief outburst by a heckler.

"You must create the change that you want to see," he told his youthful audience.

Mr Obama, on his first official visit to Israel and the occupied West Bank, said only peace could bring true security, but he did not offer any new ideas on how to revive Israeli-Palestinian peace negotiations, stalled since 2010.

"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," he said.

It was a clear warning that Israel's continued hold over the West Bank, territory captured along with the Gaza Strip and East Jerusalem in the 1967 Middle East war, would ultimately lead to an Arab majority in land controlled by the Jewish state.

"Israelis must recognise that continued settlement activity is counterproductive to the cause of peace, and that an independent Palestine must be viable, that real borders will have to be drawn," Obama said, stopping short of calling for a construction freeze.

"Put yourself in their (Palestinians') shoes. Look at the world through their eyes," he said.

"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."

Mr Obama has received an effusive welcome in Israel since his arrival on Wednesday, hoping to reset his often troubled relationship with Israeli Prime Minister Benjamin Netanyahu.

In a brief statement after Mr Obama's speech, Mr Netanyahu thanked him for "his unconditional support for the state of Israel" and said he shared the president's view that peace, ensuring Israelis' security, should be sought.

Mr Obama has faced the tough task of winning over sceptical Israelis after he bypassed their country in 2009 when visiting Egypt and offered a "new beginning" to the Muslim world in a speech at Cairo University.

Abbas meeting

Earlier, in the West Bank city of Ramallah, Mr Obama voiced opposition to settlement building but pressed Palestinian President Mahmoud Abbas to drop his demand for a freeze before peace talks can resume.

"My argument is even though both sides may have areas of strong disagreement, may be engaging in activities that the other side thinks is a breach of good faith, we have to push through those things to try to get an agreement," Mr Obama said.

The core issue now, Mr Obama said, was how to achieve sovereignty for Palestinians and security for Israelis.

"That’s not to say settlements aren't important. That's to say if we solve those problems, the settlement issue will be resolved," he added.

Some 150 Palestinian demonstrators gathered in Ramallah to protest against Mr Obama's visit.

They were held back by ranks of police who prevented them from nearing Abbas's compound.

A smiling Obama, accompanied by Abbas, was met by mostly stern-faced Palestinian officials along a red carpet - a stark contrast to the broad grins and backslapping during an elaborate welcoming ceremony on Wednesday at Israel's Tel Aviv airport.

Mr Obama, embarking on a second and final four-year term in the White House, has made clear he is not bringing any new peace initiatives and has instead has come to Israel and the Palestinian Territories on a "listening" tour.

But he said his new secretary of state, John Kerry, would spend a significant amount of time and energy trying to narrow differences between the two sides as the US seeks to move them back to the negotiating table.

A US official said Mr Kerry would return to Israel for further meetings after he accompanies Mr Obama to Jordan on Friday and Saturday.

As a reminder of the ever-present risks in the region, Iranian state television quoted Supreme Leader Ayatollah Ali Khamenei as saying Tehran would raze Tel Aviv and the city of Haifa if Israel carried out veiled threats to attack Iran.

And Palestinians in the Gaza Strip fired two rockets into Sderot, a southern Israeli town that Obama visited when running for president in 2008. Police said no one was hurt.