Israel has taken down metal detectors from entrances to a holy Jerusalem shrine to defuse a crisis that angered the Muslim world and triggered some of the worst clashes in years.

The pre-dawn operation outside the Al-Aqsa Mosque compound came after the Israeli security cabinet met for a second day to find an alternative to the metal detectors, installed after a deadly Palestinian attack at the holy site in Jerusalem’s Old City.

Jews call the site the Temple Mount and Muslims refer to it as Haram al-Sharif.

“The security cabinet accepted the recommendation of all of the security bodies to incorporate security measures based on advanced technologies (smart checks) and other measures instead of metal detectors,” Israel announced early on Tuesday.

It said the measure would “ensure the security of visitors and worshippers” at the holy site and in Jerusalem’s Old City and the police presence would increase in the area until the new security measures were in place.

Israeli media reported that high resolution cameras capable of detecting hidden objects would be deployed.

Israel installed the metal detectors after Arab gunmen killed two policemen from inside the shrine, holy to Muslims and Jews, earlier this month.

The move enraged the Muslim world and triggered violence.

The fate of the site is an emotional issue at the heart of the conflict between Israel and the Palestinians, with even the smallest perceived change to delicate arrangements sparking tension.

Just a few hours earlier, Israel and Jordan resolved a diplomatic stand-off late after a day of top-level negotiations that ended with the evacuation of Israeli embassy staff from their base in Jordan.

The crisis was triggered by a shooting on Sunday in which an Israeli embassy guard killed two Jordanians after one attacked him with a screwdriver.

Jordan said initially that the guard could leave only after an investigation, while Israel said he enjoyed diplomatic immunity.

The crisis was resolved after a phone call late on Monday between Israeli prime minister Benjamin Netanyahu and Jordan’s King Abdullah.

The relatively swift end to the stand-off signalled progress towards ending the crisis over the contested shrine.

Jordan is the Muslim custodian of the site which is also holy to Jews.

Israel’s security cabinet spent Monday trying to find an alternative to the metal detectors with ministers asked to consider sophisticated, high-resolution cameras and more police as a replacement, Israeli news reports said.

The reports had said the emerging deal could see the embassy security guard released in exchange for the removal of the metal detectors.

The 37-acre walled compound in Jerusalem is the third holiest site of Islam, after Mecca and Medina in Saudi Arabia.

It is also the holiest site of Judaism, revered as the place where biblical temples once stood.

Mr Netanyahu and King Abdullah discussed the shrine in their phone call, Jordan’s state news agency Petra said.

The king stressed the need to “remove the measures taken by the Israeli side since the recent crisis broke out” and to agree on steps that would prevent another escalation in the future, Petra said.

Earlier, the head of Israel’s domestic Shin Bet security agency met officials in Jordan to resolve the crisis, the worst between the two countries in recent years.

Jordan and Israel have a peace agreement and share security interests, but frequently disagree over policies at the shrine.

Mr Netanyahu’s office said the Israeli-Jordanian contacts were conducted in an atmosphere of co-operation.

The escalation began earlier this month when Arab gunmen fired from the holy site, killing two Israeli policemen.

In response, Israel installed metal detectors at the site, saying they were a necessary security measure to prevent future attacks.

Muslim leaders claimed Israel was trying to expand its control at the site under the guise of security, a claim Israel emphaticlly denied.

The tensions have led to mass prayer protests and deadly Israeli-Palestinian violence.

Mr Netanyahu’s government faced growing domestic criticism in recent days, with some commentators saying it made hasty decisions affecting the most volatile spot of the Israeli-Palestinian conflict.

Meanwhile, the United Nations’ Middle East envoy warned of an escalation if the crisis over the metal detectors was not resolved by the time of Muslim prayers on Friday.

After briefing the UN Security Council behind closed doors on Monday, Nikolay Mladenov said it was “critically important” that the status quo which had been in place at the site since 1967 was preserved.

Israel captured the shrine, along with east Jerusalem and other territories, in the Six-Day War in 1967.

Since then, Muslims have administered the shrine, with Jews allowed to visit, but not to pray there.