Britain's Prince William toured sensitive holy sites in disputed east Jerusalem Thursday as he wrapped up a landmark visit during which he tiptoed through the region's diplomatic minefield.
The second in line to the British throne also laid flowers at the grave of his great-grandmother who is buried at the Church of St Magdalene in east Jerusalem.
William became the first member of the British royal family to visit the flashpoint Al-Aqsa mosque compound.
Sacred to both Muslims and Jews, it is the focus of regular flare-ups between Israelis and Palestinians.
He walked through the complex, which houses the Al-Aqsa mosque and the iconic golden-topped Dome of the Rock, accompanied by a large Israeli security detail and members of the Jordanian-run religious trust that administers it.
Since Israel occupied Arab east Jerusalem in the Six-Day War of 1967, hardline Jewish activists have sought the right to pray inside the mosque compound, sparking fierce Muslim opposition.
Jews revere it as the place where they believe the biblical Jewish temples once stood.
Both the second Palestinian uprising that erupted in 2000 and a new wave of deadly violence that broke out last year had their roots in Palestinian fears of a change in the longstanding status quo at the complex, which forbids Jewish prayer there.
William's tour was followed by visits to the city's Jewish and Christian holy places.
At the adjacent Western Wall, the holiest place at which Jews are allowed to pray, the prince was accompanied by its rabbi Shmuel Rabinowitz and by Britain's chief rabbi Ephraim Mirvis.
Wearing a Jewish skullcap he placed a note in a crack between the ancient stones before laying his hand on them and closing his eyes for a few moments.
A statement from Rabinowitz's office said that William wrote a prayer for peace in the site's visitor's book.
"May the God of peace bless this region and all the world with peace," it said.
It is customary to slip written prayers or requests in between the stones that Jews believe were a supporting wall of their second temple.
From the Western Wall, the prince walked through the narrow alleyways of Jerusalem's walled Old City to the Church of the Holy Sepulchre, which most Christians believe is the site where Jesus was crucified and buried.
There he was greeted by representatives of the sometimes feuding Christian denominations which administer the church, before touring its vast multi-levelled interior.
He then re-entered the walled Old City's narrow streets for the short walk to its Jaffa Gate, where he rejoined his motorcade, before heading for Tel Aviv's Ben Gurion airport.
William arrived in Israel from Jordan on Monday evening without his wife Kate, the Duchess of Cambridge, who gave birth to their third child two months ago.
On Wednesday, during a visit to the Israeli-occupied West Bank, he appeared to fall foul of the complex language surrounding the Middle East conflict when he called the Palestinian territories a "country".
"I am very glad that our two countries work so closely together and have had success stories with education and relief work in the past," told Palestinian president Mahmud Abbas in Ramallah.
Western governments typically refrain from referring to the Palestinian territories as a country or state, instead supporting the Palestinian demand for sovereignty in the future.
The right-wing Likud party of Israeli Prime Minister Benjamin Netanyahu, who the prince met in Jerusalem on Tuesday, rejects Palestinian statehood and supports Jewish settlement in the occupied West Bank.
On Thursday, William visited the tomb of his great-grandmother Princess Alice, following in the footsteps of his grandfather Prince Philip, who visited his mother's resting place in 1994.
She was honoured as among the "Righteous among the Nations" by Israel's Holocaust memorial, Yad Vashem, in 1993 for sheltering Jews in Greece from the Nazis during World War II.
William toured the memorial and its adjacent museum on Tuesday on the opening day of his official visit, the first to both Israel and the Palestinian territories by a member of the British royal family.
"I am honoured that my own great-grandmother is one of these Righteous among the Nations," William wrote in the visitors' book.