A Palestinian gunman was killed during an overnight raid after he attempted to open fire on Israeli soldiers who came to arrest him, the army said early Sunday.

The army said the suspect — identified by police as Amar Ahmad Halil, 34, of Nabi Saleh — was behind a drive-by shooting attack on Saturday near the West Bank settlement of Ateret that left a Palestinian driver lightly hurt.

An IDF post near Nabi Saleh was also targeted by gunfire on Saturday by the suspect, the army said. There were no injuries. Soldiers later uncovered two bullet casings in the area.

In an overnight raid, security forces “operated in Nabi Saleh in order to apprehend the assailant responsible for opening fire in both Ateret and Nabi Saleh in two separate occasions on Saturday,” the army said.

“The forces encountered the suspect, who attempted to open fire at them. In response to the immediate threat forces fired towards the attacker resulting in his death,” it said.

Another Palestinian detainee was lightly injured in the firefight and was treated at the scene, the army said.

The firearm used by a Palestinian gunman who attempted to shoot Israeli troops who came to arrest him before being shot and killed on July 16, 2017 (Police spokesperson)

The firearm used by a Palestinian gunman who attempted to shoot Israeli troops who came to arrest him before being shot and killed on July 16, 2017 (Police spokesperson)

In a separate statement, Border Police said Halil drew a makeshift firearm during the arrest, prompting the troops to “open fire in his direction” and killing him.

The incident came two days after three Arab Israeli gunmen shot and killed two Israeli police officers at the Temple Mount. Security forces at the scene of Friday’s dramatic attack killed the three attackers.

Also Friday, Israeli soldiers shot dead a Palestinian during clashes in a West Bank refugee camp south of Jerusalem, officials said. According to the military, during an arrest raid in the Deheishe refugee camp, outside Bethlehem, Palestinians began throwing large rocks and explosive devices at the troops. In response, the soldiers opened fire “in order to remove the threat,” the army said.