Two police officers were killed on Friday when three Palestinians opened fire on Israelis near a major Jerusalem holy site, police said.

The shooters fled into the sacred compound and were killed in a gunfight with security forces.

The rare gunfight took place inside a sacred hilltop compound in Jerusalem, known to Jews as Temple Mount and to Muslims as Noble Sanctuary or al-Haram al-Sharif. The compound is the holiest site in Judaism and the third-holiest in Islam, after Mecca and Medina in Saudi Arabia.

The site has been a flashpoint for violence in the past, with friction there sparking major rounds of Israeli-Palestinian violence, including a Palestinian uprising against Israeli occupation that lasted several years.

Police said the site was cleared of people after the attack and will be closed for prayers Friday — the highlight of the Muslim religious week. It typically draws tens of thousands of worshippers who flock to the compound from Israel and the Israeli-occupied West Bank.

It marked only the third time since Israel’s capture of east Jerusalem in the 1967 Six Day War that authorities ordered the Muslim-administered compound closed, said Ikrema Sabri, a prayer leader at the holy site.

Police spokeswoman Luba Samri said the shooting began early Friday, near Lion’s Gate, one of the entrances into Jerusalem’s walled Old City. The mosque compound is only a few metres from Lion’s Gate.

Samri said the attackers opened fire on Israelis and then fled into the compound. Police chased and killed the assailants, she said.

Amateur video broadcast on Israeli TV stations showed a few seconds of what appeared to be confrontation between Israeli security forces and the attackers.

In the video, several people — only visible as dark figures in the footage shot from a distance — were running inside the compound. At one point, one of the figures dropped to the ground. In another moment, a puff of smoke, possibly from gunfire, was visible.

Two rifles, a hand gun and a knife were found on the bodies of the attackers.

Police are probing how the assailants were able to approach the Old City with weapons. Heavy security is in place in the area, particularly on Fridays, and young Palestinian men are frequently stopped and checked by police.