An Israeli appeal court overturned on Wednesday a ruling by a lower magistrate who had stirred Palestinian anger by questioning the legality of barring Jewish prayer at a contested Jerusalem shrine.
Al Aqsa mosque compound, which Jews revere as a vestige of their two ancient temples, is at the heart of the Israeli-Palestinian conflict. Under a decades-old "status quo" arrangement with Muslim authorities, Israel allows Jews to visit only if 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 Magistrate's Court, which ruled on Sunday that their actions had not constituted a breach of the peace.
That prompted protests from the Palestinian leadership, threats from Palestinian militants and a pledge from Israel that the status quo would be preserved.
The state filed a counter-appeal on Wednesday with Jerusalem District Court, which found in favor 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 before Wednesday's ruling, 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.
Tensions have been further stoked by a flag march due to be held by nationalist Jews in Jerusalem's Old City on Sunday, marking its capture by Israel in a 1967 war. The annual event is resented by Palestinians, who want the Old City and other parts of East Jerusalem as capital of their hoped-for future state.