Bethlehem, Israel - Pope Benedict XVI has offered his support for the Palestinians' right to a homeland as he continues his Middle East tour in the West Bank.
Speaking in a Bethlehem refugee camp, he said he understood frustrations that their "legitimate aspirations" for a Palestinian state were unfulfilled.
Standing beside him, Palestinian leader Mahmoud Abbas called on Israel to embrace peace.
Earlier, the pontiff said he prayed for a lifting of Israel's embargo on Gaza.
The BBC's Tim Franks said that the Pope used the stark backdrop of a Palestinian refugee camp to deliver one of his strongest expressions of support for the Palestinians.
Standing in the shadow of Israel's separation wall in the Aida refugee camp, which houses refugees from Israel's creation in 1948, the Pope called the barrier a symbol of "stalemate" between Israel and the Palestinians.
"In a world where more and more borders are being opened up - to trade, to travel, to movement of peoples, to cultural exchanges - it is tragic to see walls still being erected," he said.
He told the refugees that his heart went out to families divided by detention and restrictions on freedom of movement, a reference to Israeli military control of the West Bank.
"It is understandable that you often feel frustrated. Your legitimate aspirations for permanent homes, for an independent Palestinian state, remain unfulfilled."
Mr Abbas said Israel's security could only be attained through peace.
"In front of Your Holiness I address a message of peace to our Israeli neighbours," he said.
"And I call upon them to renounce occupation, settlements, arrests, and humiliations."
The BBC's David Willey in Bethlehem says that, on his journey from Jerusalem, the Pope saw for himself for the first time the barrier that the Israelis have erected in the West Bank.
Israel says it is to prevent attacks by militants, but Palestinians say it is to seize occupied land.
Speaking at a news conference at Mr Abbas's residence, the head of the Roman Catholic Church expressed support for a Palestinian state.
"The Holy See supports the right of your people to a sovereign Palestinian homeland in the land of your forefathers, secure and at peace with its neighbours, within internationally recognised borders," he said.
The Israeli government of Benjamin Netanyahu has so far refused to endorse the idea of the creation of a Palestinian state.
The Pope said Palestinians should "resist temptations to resort to acts of violence".
He later held an open-air Mass and a homily in Manger Square in front of the Church of the Nativity.
The Pope said his heart went out to those caught up in the conflict in Gaza, adding that he was praying for an end to the embargo on the territory.
One of the aims of the pontiff's visit is to preserve a diminishing Christian presence in the Holy Land.
Although the Christian population of Bethlehem has decreased dramatically in recent years through emigration, the Pope was given an enthusiastic welcome, our correspondent says.
A tiny group of Catholics from Gaza was present, after receiving special permits from the Israeli authorities to travel to the West Bank.
Pope Benedict is due to have a further meeting with Mr Abbas before his departure.
On Tuesday, the Pope visited sites in Jerusalem holy to Muslims, Jews and Christians.
He went first to the Dome of the Rock, the first pontiff to do so. It is located on the Temple Mount - a site sacred to all three monotheistic religions, and met the Grand Mufti of Jerusalem, Mohammed Mohammad Hussein.
Then the Pope followed Jewish tradition at the Western Wall, inserting a written prayer in the cracks between the 2,000-year-old stones.