A shadowy group inspired by al-Qaeda and based in Egypt’s Sinai peninsula has claimed responsibility for a shootout along the Israeli-Egyptian border in which three terrorists and an Israeli soldier were killed.

Ansar Jerusalem, in a statement posted on militant forums late Saturday, linked the attack to a video denigrating the Prophet Muhammad that has sparked protests across the Muslim world. It says the militants were Egyptian.

It said the operation was a “disciplinary attack against those who insulted the beloved Prophet.” The low-budget film was produced in the United States.

The group said three militants had crossed the border into Israel early Thursday and remained hiding until midday Friday, when they saw and attacked an Israeli patrol.

Netanel Yahalomi, 20, was shot in the head on Friday afternoon when terrorists in civilian clothing fired at his artillery force, which was securing work on the border fence in the Har Harif area while looking after a group of African migrants that had been stopped at the fence.

Three of the terrorists, who were heavily armed and, according to IDF, were planning a major attack along the border, were killed by the soldiers. Two others fled back into the Sinai, and were still being hunted by Egyptian security authorities on Saturday night.

A second soldier, who was wounded in the stomach during the incident, was in stable condition at Soroka Medical Center in Beersheba as of Saturday.

A preliminary IDF probe revealed that the gunmen exploited the presence of the group of African asylum-seekers — to whom several of the Israeli soldiers were offering basic humanitarian assistance — in order to approach the border.

The IDF has since ordered to soldiers to exercise extra caution along the border.