Muslim religious leaders in the Palestinian territories have alleged the metal detectors are part of an Israeli attempt to expand its control over the Muslim-administered site, a claim Israel denies.

Israel police severely restricted Muslim access to a contested shrine in Jerusalem’s Old City on Friday to prevent protests over the installation of metal detectors at the holy site.

Police set up a series of checkpoints, turning away worshippers heading to Jerusalem from Israel and the West Bank. About 3,000 officers were deployed around the Old City, barring entry to Muslim men under the age of 50, except for area residents.

The dispute over the metal detectors has led to rising tensions between Israel and the Muslim world, with even friendly Arab nations, such as Jordan, appealing to Israel to remove the devices.

With the heavy security measures on Friday, Israel was effectively doubling down on its earlier decision. The detectors were installed earlier this week, after a deadly Palestinian attack at the shrine left two Israeli policemen dead.

Muslim religious leaders in the Palestinian territories have alleged the metal detectors are part of an Israeli attempt to expand its control over the Muslim-administered site, a claim Israel denies.

The Muslim clerics have vowed not to relent on what has emerged as a Palestinian consensus issue, and the dispute could escalate. The volatile Jerusalem shrine, revered by Muslims and Jews, sits at the center of rival Israeli and Palestinian national narratives and has triggered major confrontations in the past.

On Friday, about 800 Palestinians gathered for noon prayers, the highlight of the Muslim religious week, at the Old City’s Lion’s Gate, one of the flashpoints of violence. In recent days, thousands have prayed in the streets near Lion’s Gate in the evenings, with smaller numbers then clashing with police.

On Friday, several dozen police officers stood near five metal detectors lined up across the gate, close the shrine, known to Muslims as the Noble Sanctuary and to Jews as the Temple Mount. The compound houses the Al Aqsa and Dome of the Rock mosques.

Worshippers assembled outside the gate, rather than pass through the police checkpoint.

Jerusalem resident Hashem Abu Diab (60), led the crowd in chants of “Allahu Akbar,” or “God is Great.”

Abu Diab said the dispute has united Jerusalem’s Palestinians who see the 37-acre (15-hectare) compound as their last sanctuary from Israel’s 50-year occupation of the eastern part of the city.

“The Al Aqsa Mosque is the last place we have in this country,” he said. “If Al Aqsa goes, we lose everything. We don’t leave until they remove the metal detectors.”

At one point, an Israeli police officer told the crowd in Arabic that ahead of the noon prayers, worshippers would be able to enter without going through metal detectors. After consultations with religious leaders, the crowd rejected the offer, insisting that the devices have to be removed altogether.

Israeli police said in a statement that the metal detectors will remain in place, but suggested police may at times choose to only conduct spot checks. “Israeli police can decide on the level of checks,” said police spokeswoman Luba Samri.

Police sharply restricted access to the Old City on Friday, after Muslim leaders had called for the faithful to converge on the shrine, but pray in the streets instead of pass through metal detectors.

Typically, tens of thousands of Muslims from Jerusalem, the West Bank and Israel converge on the shrine for Friday prayers.

On Friday, Palestinians below 50 were turned away at checkpoints on the outskirts of Jerusalem, including those heading to the city from Israel and from the West Bank. An Arab lawmaker in Israel’s parliament says he and fellow Arab citizens were stopped by police at the entrance to the city.

A Palestinian advocacy group said Israeli police detained 10 prominent Palestinian activists in Jerusalem, including the leader of Palestinian President Mahmoud Abbas’ Fatah movement in the city.

The age restrictions and police deployment came hours after Israel’s security Cabinet decided not to overrule an earlier police decision to install metal detectors at the gates to the compound.

The decision to defer to police came amid reports of disagreement among Israel’s security services about the need for the metal detectors. The military and the Shin Bet security services, which deal directly with Palestinians and potential unrest, were reportedly opposed to the devices.

Israel had come under growing pressure this week, including from security ally Jordan, to remove the metal detectors. Jordan is the custodian of the Muslim-administered walled compound.

The rule of Jordan’s Hashemite dynasty, said to trace its ancestry back to the Prophet Muhammad, rests to a large degree on its role as guardian of the site.

Abbas, the Palestinian President, asked the United States to “intervene urgently” and compel Israel to remove metal detectors, said an adviser, Nabil Abu Rdeneh.

Mr. Abbas discussed the growing tensions in Jerusalem in a phone call with Mr. Trump’s top adviser and son-in-law, Jared Kushner, Abu Rdeneh said.

Mr. Abbas told Mr. Kushner that the situation is “extremely dangerous and may go out of control” unless Israel removes the metal detectors, the Palestinian official said.