The Israeli-built West Bank security barrier is a symbol of what is "deeply wrong in the human heart", the Archbishop of Canterbury has said.
The church leaders are due back in the UK on Saturday
Dr Rowan Williams and other UK church leaders passed through the barrier on their way to Bethlehem while on a Christmas pilgrimage to the town.
There was a "fear of the other and the stranger which keeps all of us in one or another kind of prison", he said.
Israel says the barrier is needed for security purposes.
But Dr Williams expressed concern over its impact on all the town's residents.
He has also said he is worried about an exodus of Christians from Bethlehem, changing its historic Christian nature.
"We are here to say, in this so troubled, complex land, that justice and security is never something which one person claims at the expense of another or one community at the expense of another," Dr Williams said.
"We are here to say that security for one is security for all. For one to live under threat, whether of occupation, or of terror, is a problem for all, and a pain for all."
The Archbishop of Canterbury has been joined on the four-day visit by the head of the Roman Catholic Church in England and Wales, Cardinal Cormac Murphy-O'Connor, Bishop Nathan Hovhannisian of the Armenian Church of Great Britain, and the Rev David Coffey, of the Free Churches.
The men made their way through a checkpoint in the wall built along the West Bank to reach Bethlehem.
In a speech in the presence of the town's mayor Dr Victor Batarsheh, Dr Williams added: "In one of the hymns which we sing in English during the Advent season we sing about Jesus Christ as the One who comes the prison bars to break.
"And it is our prayer, and our hope for all of you, that the prison of poverty and disadvantage, and the prison of fear and anxiety will alike be broken."
On Thursday, the church leaders toured the Church of the Nativity and recited prayers in the grotto where Jesus is believed to have been born.
They are due back in the UK on Saturday.