A Palestinian opened fire at Israeli security personnel at the entrance to a West Bank settlement on Tuesday, killing three and wounding another before being shot dead, police said.
The attack, which came as US envoy Jason Greenblatt was in Jerusalem for talks on relaunching the moribund Middle East peace process, drew condemnation from Israeli officials who demanded action from the Palestinian leadership.
"A terrorist who arrived at the rear gate of Har Adar along with Palestinian labourers entering the settlement... pulled out a weapon and opened fire at the force at the site," police said.
"Three Israelis were killed in the attack, another was wounded and the terrorist was neutralised."
Police later said the Palestinian had died of his wounds.
Palestinian Islamist movement Hamas, which rules Gaza, hailed the attack as "revenge for the crime of occupation against our people."
An AFP correspondent saw a heavy police presence around Har Adar, a well-to-do settlement northwest of Jerusalem, high in the hills close to the Green Line that separates the occupied West Bank from Israel .
The windows of the guard booth at its northern entrance, where Palestinian day labourers are required to undergo security checks, had been shattered by the shooting.
The shooter was identified by police as a 37-year-old man from the nearby Palestinian village of Beit Surik who carried a work permit for the settlement.
As he approached the checkpoint at the entrance, he aroused the suspicion of security forces, who ordered him to halt, police said.
He then pulled out a pistol and opened fire on border police and civilian security guards, before being shot.
Israel 's Shin Bet internal security service identified the shooter as Nimer Aljamal, a father of four with a work permit for Har Adar and no previous "security background".
The wounded Israeli was admitted to Hadassah hospital in Jerusalem in serious condition, the hospital said.
Police said that one border policeman and two civilian guards were killed. They named the border policeman as Solomon Gavria, 20.
Har Adar resident Steve Leibowitz, 65, said the settlement's proximity to the Green Line had always made it feel safe.
"This place is quiet, we're inside the West Bank but we have a border fence and we feel as though we are inside Israel and safe," he told AFP.
"Until today I haven't locked my doors in years. Now I will be locking the doors."
The latest attack comes nearly two years after a wave of unrest broke out.
The violence had greatly subsided in recent months but Shin Bet chief Nadav Argaman warned in a briefing to the cabinet earlier this month that the risk of new attacks was ever present.
Public Security Minister Gilad Erdan told reporters in Har Adar that the issue of work permits for Palestinians, like that granted to Tuesday's attacker, should be re-examined.
He said that during the Jewish holidays, which began last week and will end in mid-October, the government should bar Palestinian labourers from entering Israel or the settlements to "keep friction low in a period in which many Jews visit Jerusalem and holy sites".
Deputy Foreign Minister Tzipi Hotovely said the Palestinian leadership needed to take action against such attacks or there would be no point in following up on the US initiative to relaunch peace talks.
"The terrible attack at Har Adar is the Palestinian reception for US envoy Jason Greenblatt," she said.
"The American efforts must focus first of all on ending the murderous Palestinian terror."
Hotovely renewed the Israeli government's call for the Palestinian Authority to stop paying allowances to the families of those who lost their lives carrying out attacks.
"There's no point negotiating with someone who just fans the flames of terror and continues to pay terrorists' families," she said.
The issue is a deeply divisive one, with many Palestinians seeing those killed carrying out attacks against the "occupation forces" as martyrs, while Israelis see them as "terrorists".
Since October 2015, the unrest in Israel and the Palestinian territories has killed at least 295 Palestinians or Arab Israelis, 50 Israelis, two Americans, two Jordanians, an Eritrean, a Sudanese and a Briton, according to an AFP toll.
Israeli authorities say that most of the Palestinians killed were carrying out knife, gun or car-ramming attacks.
West Bank settlements are a source of significant tensions between Israel and the Palestinians and have been a major sticking point in peace talks.
The UN envoy to the Middle East Nickolay Mladenov told the Security Council on Monday that Israel continues to build settlements "at a high rate," in defiance of Security Council demands for an end to the expansion of Jewish outposts.
The international community regards all Jewish settlements in the occupied West Bank, including Israeli-annexed east Jerusalem, as illegal.