(CNN)It is unusual for militant Islamists to condemn terror attacks against "non-believers," but so grotesque was last Friday's onslaught in Egypt that several extremist groups have threatened revenge against its perpetrators.
Why the massacre of Muslims in Sinai was too extreme for al Qaeda
While no one has yet claimed the attack, its location and method point to the Islamic State in Northern Sinai (ISNS), a group that has proved both ruthless and resilient in the face of the Egyptian military's attempts to crush it over the last four years.
More than 300 people were killed -- among them nearly 30 children -- as they attended prayers at the al Rawdah mosque near the Sinai town of Bir al-Abed. The mosque was associated with the Sufi tradition within Islam, which is regarded as apostasy by ISIS and by some in al Qaeda.
The Islamic State in Northern Sinai is an affiliate of ISIS and the most powerful jihadist group in Egypt -- but not the only one. Smaller militant factions closer to al Qaeda quickly distanced themselves from the mosque attack.
Jund al-Islam, which is regarded as pro-al Qaeda, declared that it was "a great sin and transgression to violate the sanctities of Muslims." It claims to have carried out an attack last month against ISNS, which it regards as "Khawarij" -- a term from the 8th century used to describe those who go against Islamic leaders and institutions.
Another militant group -- Ansar al-Islam -- offered condolences to the families of the victims of the massacre and said that God promised torment for anyone who killed a Muslim unjustly. In a statement issued on Saturday, it pledged to take revenge against the "transgressors who spilled the blood of the worshipers in a house of Allah."
Ansar al-Islam is well-organized and regarded as more aligned with al Qaeda than ISIS. It claimed responsibility for a devastating ambush of Egyptian troops in the western desert last month.
The group is led by Hisham Ashmawy, a former captain in the Egyptian special forces. Ashmawy belonged to the group in Sinai that preceded ISNS -- known as Ansar Beit al-Maqdis -- but he appears to have left when it became an affiliate of ISIS. Counter-terrorism analysts have said the split was both ideological and to do with personal rivalries.
The condemnation of the ISNS attack is evidence of the ever-widening enmity between ISIS affiliates and al Qaeda-inspired groups, and raises the question of whether the latter will begin to confront ISNS militarily as well as ideologically.
ISIS is doctrinaire about its definition of true Muslims, and has often warned that it would target the Sufi community. "Our focus lies in the war against polytheism and apostasy, and among those Sufism, sorcery and divination," said a spokesman in ISIS' online publication al-Naba a year ago. The article even mentioned al Rawdah, yet the mosque appears to have had little protection.
ISIS is not alone among jihadi groups in targeting other Muslim denominations, and especially Sufis. Adherents of Boko Haram in Nigeria also see Sufism as apostasy. In Pakistan, Sufi shrines have come under frequent attack, most recently in February this year, when a suicide bombing claimed by ISIS killed at least 70 people. And when Islamist militants linked to al Qaeda briefly seized the city of Timbuktu in Mali in 2012, they demolished centuries-old Sufi mausoleums and libraries, several of which were UNESCO world heritage sites.
Unlike ISIS, the core leadership of al Qaeda has not singled out Sufi communities for attack. It has also distanced itself from overtly sectarian campaigns of violence against the Shia, most notably by Abu Musab al Zarqawi during the Iraqi insurgency between 2004 and 2006. Zarqawi's attacks, such as the attempt to destroy the al Askari mosque in Samarra, drew criticism from al Qaeda's leaders -- even though he was affiliated to al Qaeda at the time.
But the rhetoric of al Qaeda and its affiliates against the Shia has hardened in recent years -- especially in Syria and Yemen, amid what some observers call a multidimensional civil war within Islam.
ISNS has frequently shown its audacity in Sinai, even sometimes erecting roadblocks around al-Arish, the Mediterranean town at the heart of the violence and some 40 kilometers from al Rawdah.
The group is well-armed and well-trained. On one occasion it used a missile to hit an Egyptian patrol boat off the coast. It has expertise in building IEDs, which have taken a heavy toll on Egyptian security patrols. And in 2015 it claimed to have smuggled a bomb inside a soda can on board a Russian airliner which exploded shortly after leaving Sharm el-Sheikh in southern Sinai.
The nature of Friday's assault, a complex operation involving both a bomb attack and subsequent ambush of worshipers and ambulances by dozens of fighters, is typical of ISNS. But it is different in one crucial respect: most of the group's attacks until now have targeted Egyptian security forces in Sinai -- whether by IED or assassination.
Not for the first time, President Abdel Fattah el-Sisi threatened to crush the militants, saying in a short statement that "the armed forces and police will avenge our martyrs and restore security and stability with the utmost force."
It is a familiar pledge, but the impunity with which the attackers struck demonstrates the inability of the Egyptian security forces to stamp out ISNS, despite a massive deployment of the army and strikes by F-15 fighter jets.
Omar Ashour, visiting professor at the Arab Center for Research and Policy Studies in Qatar and a longtime observer of the Sinai insurgency, says the mix of guerrilla warfare and urban terror tactics has "undermined both the morale and the capacities of the regular forces, a historically incompetent one with limited success in conventional warfare and counter-insurgency campaigns."
The government has been able to recruit some tribes against ISNS, but the group has still been able to find recruits among the marginalized Bedouin youth of Sinai, long a neglected backwater of Egypt where the writ of central government means little. It is helped by the fact is that Sinai is huge -- almost the size of Texas -- and sparsely populated.
Sinai also has a long history of smuggling -- of people, drugs and weapons -- and counter-terrorism analysts say ISNS has been able to obtain weapons by sea from Libya and elsewhere.
The staying power of ISNS and its growing capabilities also concern Israel. The group has attempted several border incursions, and several ISIS operatives have been detained by Hamas in Gaza, after apparently crossing from the Sinai.
Amos Harel -- writing in Haaretz -- was critical of the Egyptian military's response, saying "quicker action is needed, combining precise intelligence and commando forces."
But Ashour says the Egyptian state's over-reliance on force in Sinai, coupled with the neglect of the region and a polarized political situation in Egypt as a whole, suggest the government is a long way from bringing peace to the area.