Israel has arrested the brother of a 20-year-old Palestinian who stabbed to death three members of an Israeli family.

The attacker, identified as Omar al-Abed, 20, had sneaked over the fence of the Israeli settlement of Halamish in the West Bank late on Friday and infiltrated the family’s home, surprising them during a Shabbat dinner.

The army said the attacker killed a man and two of his children, while a woman was wounded.

Eli Bin, the head of Israel’s rescue service MDA, said an off-duty soldier next door heard screams, rushed to the home and shot the attacker through a window. He was taken to hospital.

Ibrahim al-Abed, an uncle, said troops searched the family home in the village of Kobar on Saturday and arrested al-Abed’s 21-year-old brother Monir.

In a Facebook post on Friday, Omar al-Abed said he was avenging what he called Israel’s “desecration” of a Jerusalem shrine.

Street clashes over the shrine earlier left three Palestinians dead.

Several thousand Palestinians in Jerusalem and the West Bank clashed with Israeli troops, burning tyres or throwing stones and firecrackers.

Troops fired live rounds, rubber bullets and tear gas. Three Palestinians were killed and several dozen taken to hospital with live or rubber bullet injuries.