JERUSALEM -- A Palestinian attacker opened fire early on Tuesday at the entrance to a settlement outside Jerusalem, killing three Israeli men and critically wounding a fourth, Israeli police and medical services said, in one of the deadliest attacks in a two-year spate of violence.

Police spokeswoman Luba Samri said the attacker was a 37-year-old Palestinian who approached the back gate entrance of the Har Adar settlement, hiding among fellow Palestinian day laborers who were being checked by security forces.

She said he aroused their suspicions and was asked to stop. At that point, he pulled out a weapon and began opening fire from a short distance. The attacker, who held a valid permit to work in Israel, was then shot dead by other forces at the scene.

Get Breaking News Delivered to Your Inbox

The Magen David Adom medical service said that in addition to the three men in their 20s and 30s who were killed, a fourth Israeli man, 32, was evacuated to hospital in critical condition.

Har Adar is an upscale community west of Jerusalem, straddling the seam line between the West Bank and Israel proper - and an unusual target in the wave of violence that Israel has been coping with over the past two years.

Shay Retter, the head of Har Adar's security committee, said that between 100 and 150 Palestinian laborers typically enter the community each day for work.

Since September 2015, Palestinians have killed 48 Israelis, two visiting Americans and a British tourist in stabbings, shooting and car-ramming attacks.

During that same time, Israeli forces have killed over 255 Palestinians. Israel says most of them were attackers and others died in clashes with Israeli forces. Most of the attacks have been stabbings against security forces, primarily in the West Bank.

Israel blames the violence on incitement by Palestinian religious and political leaders compounded on social media sites that glorify violence and encourage attacks. Palestinians say the attacks stem from anger and frustration at decades of Israeli rule in territories they claim for a state.

The frequency and intensity of attacks has lessened of late but such an incident, coming amid the Jewish high holiday, threatened to ignite them anew.

Israeli President Reuven Rivlin said "the cruel terror attack proves once again the daily front that our security forces face in the most important mission - protecting and defending the safety of the citizens of Israel."

Israel's Cabinet was to convene later in the day for a previously scheduled meeting.