An Israeli court has overturned a magistrate's ruling that questioned the legality of banning Jewish prayer at Al Aqsa Mosque compound.
The compound in East Jerusalem's Old City is the third-holiest site in Islam. Jews, who revere it as the site of ancient temples, are permitted to visit but not pray there.
On Sunday, the Jerusalem Magistrates Court ruled in favour of three Jewish youths who challenged a restraining order imposed by police after they prayed at the site. The court said their actions did not constitute a breach of the peace.
The decision prompted protests from the Palestinian leadership, threats from Palestinian militants and a pledge from Israel that the status quo would be preserved.
The government filed a counter-appeal on Wednesday with the Jerusalem District Court, which found in favour of the state after nightfall.
The "special sensitivity" of the site cannot be overstated, Judge Einat Avman-Moller said in her ruling.
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.
Al Aqsa compound is the focal point of the conflict between Israel and Palestinians, who are angered by increasing Jewish visits to the site.
Jordan, which serves as custodian of Al Aqsa, has also voiced concern.
Anger over the increasing Jewish visits to the compound during Ramadan this year, which coincided with the Jewish Passover festival, sparked confrontations with Israeli security forces that left hundreds of Palestinian worshippers wounded.
Jordan, a US-backed Israeli security partner that serves as custodian of Al Aqsa, has also voiced concern about the status of the site.
Tension is rising again over a flag march to be held on Sunday by nationalist Jews in Jerusalem's Old City to mark its capture by Israel during the 1967 war.
The annual event is resented by Palestinians, who want the Old City and other parts of East Jerusalem as the capital of a future state.
The US Embassy in Jerusalem urged vigilance on Wednesday, adding an advisory that US government employees and their families "cannot enter the Old City at any time on Sunday".