Three Arab-Israeli gunmen shot dead two Israeli policemen near one of Jerusalem's most holy places on Friday and were then killed by security forces, police said.
It was one of the most serious attacks in years so close to the volatile holy site, known to Muslims as the Noble Sanctuary and to Jews as Temple Mount.
Israeli authorities shut the area to Muslims gathering for Friday prayers, prompting anger among Palestinian religious leaders. The Grand Mufti of Jerusalem, Mohammad Hussein, urged Palestinians to defy the closure and was later reported to have been detained.
Palestinian President Mahmoud Abbas condemned the attack in a phone call with Israeli Prime Minister Benjamin Netanyahu, but also said closing down the area could have repercussions.
No group claimed responsibility for the attack, though the Palestinian Islamist group Hamas, which rules the Gaza Strip, praised it.
The three gunmen arrived at the sacred site, which stands on a marble and stone plateau on the edge of Jerusalem's Old City, and walked toward one of the nearby ancient stone gates, police spokeswoman Luba Simri said.
"When they saw the policemen they shot toward them and then escaped toward one of the mosques in the Temple Mount compound," Simri said. "A chase ensued and the three terrorists were killed by police."
She said three firearms were found on their bodies. The Shin Bet, Israel's internal security service, said the gunmen were all Arab citizens of Israel who were unknown to the authorities.
Mobile phone video footage aired by Israeli media showed several police chasing a man and shooting him at the site, a popular place for foreign tourists to visit.
The two policemen killed were Israeli Arab citizens from the country's Druze community. The Israeli ambulance service said a third policeman had been lightly wounded in the incident.
Tensions are often high around the compound, which houses the Aqsa Mosque and the golden Dome of the Rock. It is managed by Jordanian religious authorities and is adjacent to the Western Wall, a holy site where Jews are permitted to pray.
Police said Friday prayers for Muslims would not be held at the site following the attack for security reasons, while forces scanned the area for weapons and investigated the incident.
Netanyahu said the compound would be reopened gradually from Sunday, in accordance with security assessments.
The compound has served as a tinder-box for the Israeli-Palestinian conflict in the past. Under a delicate status quo agreement, Jews are allowed to enter the compound under closer supervision but only Muslims are permitted to pray.
In an apparent effort to ease tensions, Netanyahu said in a statement there would be no change to the status quo, in which only Muslim prayer is permitted, a message he reiterated in his phone call with Abbas, according to Netanyahu's office.
Authorities have often restricted access to the Aqsa mosque when concerned about possible violence there, but a total shutdown is rare.
Friday's closure prompted hundreds of Muslim worshippers to gather outside the walled Old City gates and hold prayers there.
"We completely reject the ban by Israeli authorities," Grand Mufti Hussein told Reuters by telephone. "We have urged our Palestinian people to rush to al Aqsa today and every day to hold their prayers."
Ofer Zalzberg, senior analyst at the International Crisis Group think-tank, said images of the gunman being shot dead at the sacred site made the situation even more volatile.
"This can have much broader impact because defending al Aqsa is at the core of Palestinian nationalism," Zalzberg told Reuters. "Israel's response of closing access entirely to Muslims in an attempt to deter further attacks actually exacerbates the crisis."
An aide to Hussein said the Mufti was later detained by police at the Old City. A police spokesman could not confirm that report. Reuters video footage showed the Mufti being escorted away by a man in plain clothes, through a crowd of Palestinians gathered near the compound gate.
A wave of Palestinian street attacks that began in 2015 has slowed but not stopped. At least 257 Palestinians and one Jordanian citizen have been killed since the violence began. A few of the attacks were carried out by Arab Israeli citizens.
Israel annexed East Jerusalem, where the Old City and the holy compound are located, after the 1967 Middle East war and regards all of Jerusalem as its capital, a claim not recognized internationally.
Palestinians want East Jerusalem as the capital of a state they hope to establish in the West Bank and Gaza Strip.