A Palestinian gunman has opened fire outside an east Jerusalem synagogue, killing seven people and wounding three others before police shot and killed him, officials said.

The attack, which took place as worshippers were celebrating the Jewish Sabbath, came a day after an Israeli military raid killed nine people in the West Bank.

The burst of violence has posed an early challenge for Israel’s new government, which is dominated by ultranationalists who have pushed for a hard line against Palestinian violence.

Israel Palestinians
Israeli border police force secure the site (Mahmoud Illean/AP)

Israeli police said the shootings occurred in Neve Yaakov, a religious neighbourhood with a large ultra-Orthodox population, and that the gunman fled in a car after opening fire.

Police said they chased him and killed him after an exchange of fire.

Officers identified the attacker as a 21-year-old east Jerusalem resident who apparently acted alone.

Jerusalem police chief Doron Turjeman promised an “aggressive and significant” effort to track down anyone who had helped him.

Israel’s Mada rescue service said the dead were five men and two women, including several who were 60 or older. Jerusalem’s Hadassah Hospital said a 15-year-old boy was recovering from surgery.

It was deadliest attack on Israelis since a 2008 shooting killed eight people in a Jewish seminary in Jerusalem, according to Israel’s Foreign Ministry.

Israel Palestinians
The scene of the attack in Jerusalem (Mahmoud Illean/AP)

Addressing reporters at Israel’s national police headquarters, Prime Minister Benjamin Netanyahu said he had held a security assessment and decided on “immediate actions”.

He said he would convene his Security Cabinet on Saturday night, after the end of the sabbath, to discuss a further response.

Mr Netanyahu declined to elaborate but said Israel would act with “determination and composure”. He called on the public not to take take the law into their own hands.

Palestinians had earlier marched in anger as they buried the last of the people killed by Israeli fire a day earlier, but the likelihood of a major conflagration had initially appeared to ebb after the deadliest Israeli raid in two decades.

Scuffles between Israeli forces and Palestinian protesters erupted after the funeral for a 22-year-old Palestinian north of Jerusalem and elsewhere in the occupied West Bank, but calm prevailed in the contested capital and in the blockaded Gaza Strip.

Thursday’s raid in the Jenin refugee camp descended into a gun battle that killed at least nine Palestinians, while clashes elsewhere left a 10th dead.

Gaza militants then fired rockets and Israel carried out air strikes overnight, but the exchange was limited, following a familiar pattern that allows both sides to respond without leading to a major flare-up.

Israel Palestinians
Palestinians protest after the funeral of Yusef Muhaisen in the West Bank town of al-Ram (Majdi Mohammed/AP)

Israel’s defence minister instructed the military to prepare for new strikes in the Gaza Strip “if necessary” — also appearing to leave open the possibility that violence would subside.

At the funeral of the 22-year-old, crowds of Palestinians waved the flags of Fatah, the party that controls the Palestinian Authority, and militant Hamas, which rules Gaza.

In the streets of the town of al-Ram, masked Palestinians threw stones and set off fireworks at Israeli police, who responded with tear gas.

But the Palestinian rockets and Israeli air strikes seemed limited to prevent growing into a full-blown war. Israel and Hamas have fought four wars and several smaller skirmishes since the militant group seized power in Gaza from rival Palestinian forces in 2007.

The Palestinians’ rockets were fired toward southern Israel, while Israel’s non-lethal air strikes were on targets in Gaza, such as training camps and an underground rocket-manufacturing site.

Israeli defence minister Yoav Gallant claimed the military dealt a “tough blow” to Palestinian militants in Gaza and said the army was preparing to strike “high-quality targets… until peace is restored to the citizens of Israel”.

Israel Palestinians
Mourners carry the body of Yusef Muhaisen (Majdi Mohammed/AP)

Tensions have soared since Israel stepped up raids in the West Bank last spring after a series of Palestinian attacks.

Jenin, which was an important militant stronghold during the 2000-05 intifada and has again emerged as one, has been the focus of many of the Israeli operations. Among the dead in Thursday’s raid were seven militants and a 61-year-old woman.

Nearly 150 Palestinians were killed in the West Bank and east Jerusalem last year, making 2022 the deadliest in those territories since 2004, according to Israeli rights group B’Tselem.

Last year, 30 people were killed in Palestinian attacks against Israelis.

So far this year, 30 Palestinians have been killed, according to a count by the Associated Press.

Israel says most of the dead were militants, but youths protesting against the incursions and others not involved in the confrontations also have been killed.