Palestinians pray on Laylat al-Qadr during the holy month of Ramadan, at the compound that houses Al-Aqsa Mosque and Dome of the Rock, known to Muslims as Noble Sanctuary and to Jews as Temple Mount, in Jerusalem's Old City April 27, 2022
Palestinians pray on Laylat al-Qadr during the holy month of Ramadan, at the compound that houses Al-Aqsa Mosque and Dome of the Rock, known to Muslims as Noble Sanctuary and to Jews as Temple Mount, in Jerusalem's Old City April 27, 2022 Reuters / AMMAR AWAD

An Israeli appeal court on Wednesday overruled a magistrate who had stirred Palestinian anger by questioning the legality of barring Jewish prayer at a contested Jerusalem shrine, as the United States warned its citizens over travel in the vicinity.

Al Aqsa mosque compound, which Jews revere as a vestige of their two ancient temples, is in Jerusalem's Old City and at the heart of the Israeli-Palestinian conflict. Under a decades-old "status quo" arrangement with Muslim authorities, Israel allows Jews to visit on condition they refrain from religious rites.

Three Jewish youths who received a restraining order after praying at the site successfully challenged the police decision at Jerusalem Magistrates Court, which ruled on Sunday that their actions had not constituted a breach of the peace.

That prompted protests and threats from the Palestinians and a pledge from Israel that the status quo would be preserved. A planned flag march by Israeli nationalists in the Old City on May 29 has further stoked tensions.

The state filed a counter-appeal on Wednesday with Jerusalem District Court, which found in favour after nightfall.

"The special sensitivity of the Temple Mount cannot be overstated," Judge Einat Avman-Moller said in her ruling, using the Hebrew name for a site Muslims know as the Noble Sanctuary.

A right to freedom of Jewish worship there "is not absolute, and should be superseded by other interests, among them the safeguarding of public order", she said.

In a statement to Reuters, Nati Rom, a lawyer for the defendants, said: "It is strange and regrettable that, in the 21st century, in a Jewish and democratic country, the basic human rights of Jews would be so harmed."

With Jewish visits increasing in number, including over the Muslim fasting month of Ramadan that coincided this year with the Jewish Passover festival, Palestinians have cried foul.

Jordan, a U.S.-backed Israeli security partner that serves as custodian of Al Aqsa, has also voiced concern.

The flag march, scheduled for Sunday, marks the Old City's capture by Israel in a 1967 war. The annual event is resented by Palestinians who want the Old City for a hoped-for future state.

The U.S. Embassy in Jerusalem urged vigilance on Wednesday, adding an advisory that U.S. government employees and their families "cannot enter the Old City at any time on Sunday".

(Writing by Dan Williams; Editing by Bill Berkrot, John Stonestreet and Gareth Jones)