A Palestinian opened fire at Israeli security personnel killing three and wounding another before being shot dead, police said. The attack occured at the entrance to a West Bank settlement.
The violence, which came as US envoy Jason Greenblatt was due in Jerusalem for talks on relaunching the moribund Middle East peace process, drew condemnation from Israeli officials who called for action from the Palestinian leadership.
It also occurred in the middle of the Jewish high holiday period, when Israeli-Palestinian violence has erupted in the past, and led police to order reinforcements to prevent further unrest.
Israeli Prime Minister Benjamin Netanyahu demanded a clear condemnation of the attack from Palestinian president Mahmud Abbas, adding that the gunman's home would be demolished and Israeli work permits withdrawn from his extended family.
The target of the attack was 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 laborers are required to undergo security checks, had been shattered by the shooting.
Police spokesman Micky Rosenfeld told AFP that the gunman, who had a permit to work in the settlement, had concealed himself among other Palestinian laborers.
"He hesitated and then all of a sudden, several metres (yards) before a security check, pulled out a nine millimetre weapon and opened fire directly at the two private security guards, who were shot and killed directly at the scene," Rosenfeld said.
"He also opened fire to a border police officer that was also located here.
"And another two officers, that were standing approximately where we are at the moment, responded, opened fire and shot and killed that terrorist."
Work permits under review
Israel's Shin Bet internal security service identified the gunman as Nimer Aljamal, a 37-year-old father of four from the nearby Palestinian village of Beit Surik with no previous "security background."
Rosenfeld described Aljamal's profile as "very unusual" by comparison with others who have carried out lone-wolf attacks during a wave of unrest that has hit Israel and the Palestinian territories over the past two years.
He said there would have to be a security review of work permits for Palestinians to work in Israel and the settlements, with thousands granted.
Netanyahu called on the Palestinian president to condemn the attack.
"I expect (Abbas) to condemn the attack and not try to justify it," he said.
Palestinian Islamist movement Hamas, which rules Gaza, hailed the attack as "revenge for the crime of occupation against our people."
The UN envoy to the Middle East Nickolay Mladenov condemned both the attack and the Hamas reaction.
"It is deplorable that Hamas and others continue to glorify such attacks, which undermine the possibility of a peaceful future for both Palestinians and Israelis," he said.
Police named the border policeman killed 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.
'Reception for US envoy'
Deputy Foreign Minister Tzipi Hotovely said the Palestinian leadership needed to take action 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.
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.
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."
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 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 their expansion.
The international community regards all Jewish settlements in the occupied West Bank, including Israeli-annexed east Jerusalem, as illegal.
They are seen as major stumbling blocks to peace as they are built on land the Palestinians see as part of their future state.