Egypt’s restive northern Sinai province, where at least 235 people were killed and scores more injured in a bomb and gun assault on a mosque on Friday, has been under a state of emergency since October 2014, when Islamist militants killed more than 30 soldiers in one operation.

More than three years of fighting has failed to crush an insurgency waged by the local Islamic State affiliate, Wilayat Sinai (the Governorate of Sinai), which is also blamed for bombing attacks on churches in Cairo and other cities, killing dozens of Christians. It had also carried out the previous deadliest attack in Sinai when it downed a Russian passenger jet carrying tourists back from the resort of Sharm el-Sheikh in 2015, killing 224 people.

The most obvious suspect for the attack in Bir al-Abed is again Wilayat Sinai, though there has been no claim of responsibility.

One clue is the target: worshippers from the mystic Sufi strand of Islam, which is frowned upon by Muslims who follow the rigorous and puritanical version of the faith associated with many Gulf countries. Isis sees Sufis as apostates, and thus not just legitimate targets, but obligatory ones.

Wilayat Sinai is one of more than a dozen Isis affiliates established by high command around the Middle East in 2014. As elsewhere, Isis leaders in Iraq used an existing local group as a base for expansion in Egypt. While other “governorates”, such as those in Libya and Algeria, have been almost entirely eliminated, Isis in Egypt has established a potent capability despite the continual efforts of the Egyptian authorities to destroy it.

“It very much fits the Isis modus operandi, even if they are not the only group with the capability locally … [Isis in Sinai] is a potent organisation,” said Daveed Gartenstein-Ross, a US-based terrorism specialist.

Earlier this year Isis in Egypt had focused its assaults on Egypt’s Christian minority and killed dozens in at least four attacks.

In July, extremists killed 23 soldiers, including five officers, in an attack on a military checkpoint. This strike was claimed by Isis but is now thought by investigators to have been carried out by local groups affiliated to rivals al-Qaida, which is also active in Egypt.

Ayman al-Zawahiri and Saif al-Adel, the leader of al-Qaida and his most senior lieutenant, are both Egyptian, and have long been keen to expand the organisation’s presence in their homeland.

Al-Qaida targets military personnel, police or officials, but not ordinary Muslims, even Sufis, as part of a “hearts and minds strategy” designed by al-Zawahiri. “Al-Qaida is not more moderate than Isis … just more pragmatic,” said Gartenstein-Ross.

The deeper causes of the violence in Sinai are tragically familiar from elsewhere in the Middle East.

There is the legacy of the 2011 Arab spring uprisings. The fall of President Hosni Mubarak in Egypt led to political turmoil, a security vacuum in parts of the country, and the release of thousands of jailed Islamist militants. The end of Muammar Gaddafi’s rule in Libya released a flood of weapons.

There is also a background of deep and long-held grievances among the marginalised Bedouin tribes of the Sinai. The clumsy and brutal counter-terrorist efforts of recent years have not helped.

One hope is that the deaths on Friday will not be in vain. An attack in 1997 in Luxor killed more than 60 foreign holidaymakers, crippled the tourist industry and appalled ordinary Egyptians. It swung public opinion squarely against the extremists, limiting recruitment and fundraising, while boosting support for an invigorated counter-terrorist campaign. It was a turning point. The campaign against the extremists in Egypt desperately needs another.