The attackers opened fire on Israelis and then fled into the compound. Police gave chase and killed the assailants.

Three Palestinians opened fire on Israelis near a major Jerusalem holy site on Friday, wounding three before fleeing into the sacred compound where they were killed in a gunfight with security forces, police said.

The rare gunfight took place inside a sacred hilltop compound in Jerusalem, known to Jews as Temple Mount and to Muslims as Noble Sanctuary. 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 on 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 Mideast 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 incident began early on Friday, near Lion’s Gate, one of the entrances into Jerusalem’s walled Old City. The mosque compound is only a few yards (meters) from Lion’s Gate.

Ms. Samri said the attackers opened fire on Israelis and then fled into the compound. Police gave chase 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.

It was the latest bloodshed in a wave of Palestinian attacks that erupted in 2015, in part over the Jerusalem holy site.

In that time, Palestinian attackers have killed 43 Israelis, two visiting Americans and a British tourist in stabbings, shootings and attacks using cars to ram into troops or civilians.

During that period, Israeli forces have killed more than 254 Palestinians, most of them said by Israel to be attackers while others were killed in clashes.