Israel ministers overnight Tuesday decided that the metal detectors set up outside the Temple Mount in Jerusalem — in the wake of a terror attack at the holy site in which two Israeli police officers were killed — would be removed, and replaced with security measures based on “advanced technologies.”

The Prime Minister’s Office said 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 in order to ensure the security of visitors and worshippers in the Old City and on the Temple Mount.”

Israeli media reported earlier Monday that high-resolution cameras capable of detecting hidden objects would be the alternative.

The Prime Minister’s Office said the implementation of the plan would take up to six months and that a budget of up to NIS 100 million ($28 million) was allocated for the measures, based on a plan to be presented by the Public Security Ministry.

The government said police units would meanwhile be reinforced in and around the site as necessary to ensure security. Earlier Monday, Associated Press footage showed heavy machinery and workers heading to the entrance of the site.

As word spread of the decision, a few hundred Palestinians gathered to celebrate at Lions Gate, near an entrance to the Temple Mount. One person set off a firework, prompting Israeli police to disperse the group. Clashes were reported between the Palestinians and police.

The cabinet decision came hours after Israel and Jordan ended a diplomatic stand-off, enabling the return of Israeli embassy staff from Amman following an attack Sunday at a residential building near the mission in which two Jordanian nationals were killed, including an assailant.

The metal detectors were set up by Israel following a July 14 attack in which three Arab Israeli assailants killed two Israeli Druze officers just outside the Temple Mount, having stashed their weapons at the holy site beforehand and having emerged from it to carry out the attack. In a rare move, Israel shut the site that day and July 15, and re-opened it with new security arrangements in place. The implementation of the measures set off daily unrest and clashes between Palestinian rioters and Israeli police in and around East Jerusalem and the West Bank.

The violence came to a head Friday after midday prayers as three Palestinian protesters were killed in violent riots against security forces. Another two died in clashes on Saturday.

Late on Friday, a Palestinian terrorist stabbed to death three members of the Salomon family at their Shabbat table in the West Bank settlement of Halamish, as others, including children, rushed to hide. He was shot and wounded by an off-duty soldier who lives nearby.

The cabinet decision to remove the metal detectors came shortly after Israel and Jordan came to an agreement regarding the safe return of an Israeli security guard injured in a stabbing attack at the Israeli embassy in Amman on Sunday.

The incident caused a diplomatic flare-up between the two countries, as the guard killed his attacker and another Jordanian national. Jordanian authorities had initially sought to interrogate the guard over the incident, while Israel refused to hand him over, in what devolved into a tense standoff.

In a statement Tuesday, Prime Minister Benjamin Netanyahu thanked US President Donald Trump for “directing [senior adviser and son-in-law] Jared Kushner and dispatching Jason Greenblatt to help with our efforts to bring the Israeli embassy staff home quickly. I thank King Abdullah [II] as well for our close cooperation.”

Greenblatt had arrived in Israel earlier for talks over the crisis.

The guard and other Israeli embassy staff, including the ambassador, Einat Schlein, crossed from Jordan back into Israel late Monday.

In the hours before the embassy staff returned, Netanyahu spoke by phone with the Jordanian monarch, who reportedly demanded the removal on the metal detectors at the Temple Mount, which houses the Al-Aqsa Mosque and the Dome of the Rock, and is administered by a Jordanian-controlled Islamic trust.

The Temple Mount is the holiest site in Judaism and is revered as the site of the biblical temples. It is also the third-holiest site in Islam, after Mecca and Medina, and is known to Muslims as the Haram al-Sharif. Under an arrangement in place since Israel captured the Old City in the Six Day War in 1967, non-Muslims are allowed access to the site but are forbidden to pray there. Under this status quo, Israel is responsible for security at the site while the Jordanian trust — the Waqf — administers it.

Jordan had been highly critical of the placement of metal detectors at the site, as have the Palestinians, who alleged the security measures were a bid by Israel to assert control over the Temple Mount and thus a change to the status quo — a charge Israel has repeatedly denied.

The Prime Minister’s Office had earlier denied a Channel 2 report that Amman had demanded the metal detectors be removed as a condition for securing the passage of the Israeli security guard.

Agencies contributed to this report.