CAIRO — Egypt's security forces were on high alert Saturday after striking back at militants whose massacre of more than 300 people at a Sinai mosque raised fears of a new and bloodier phase in the country's struggle against Islamist insurgents.
Egypt's state-run Information Service tried to portray Friday's carnage — at least 305 dead, or about quarter of the male population of the village of Rawda — as a sign of "weakness, despair and collapse" among militants opting for easy civilian targets rather than hitting heavily armed security forces as in the past.
But the level of coordination and precision by the attackers gave no obvious suggestions of a struggling force in an area where Islamic State-inspired groups have gained a key foothold.
The assault on a mosque — a rarity in Egypt — also raised concerns over increasing threats to the country's Sufi Muslims, whose mystic interpretation of Islam is at odds with the Islamic State's hard-line creed.
Survivors and officials described five pickup trucks carrying up to 30 gunmen — some of them masked — converging on al-Rawda mosque as the imam began his sermon. Some worshipers died in a suicide blast; others were gunned down as they ran. The attackers would later walk among the fallen, 27 of them children, shooting those who appeared to be breathing.
Eyewitnesses said that some had carried a black flag that local residents recognized as belonging to the State of Sinai, a local Islamic State affiliate that has remained largely intact even as the Islamic State has lost its strongholds in Iraq and Syria.
By the time the attackers left, there were so many bodies on the ground that a fleet of ambulances couldn't hold them, said a local resident, Muhamed Khalil, 25. Instead, the bodies were piled high in pickup trucks and in the trunks of private cars.
Although no group has claimed responsibility for the attack, suspicion immediately fell on Islamic State-linked militants who have dueled with the army across the desert region.
President Abdel Fatah al-Sissi vowed to avenge the bloodshed with "brute force" — pushed by widespread horror to act with more resolve. But the contours of a tougher approach remain hazy.
Egyptian security forces have been locked in battle with the country's Islamic State affiliate for several years. The insurgency has killed hundreds in the heavily patrolled Sinai region, and militants have struck farther afield, including Coptic Christian churches in Cairo and Alexandria.
"The Egyptian government has been describing its reaction to every attack as a harsh response since the summer of 2013, if not before. So it's difficult to assess what is meant by a promise to do more than that," said Zack Gold, a nonresident fellow with the Atlantic Council's Rafik Hariri Center for the Middle East.
Late Friday, the army said that it launched airstrikes on vehicles apparently used by the assailants, but it was unclear whether any suspected militants were killed in the counterattack.
In Rawda, a hamlet off the road that cuts across the northern part of the Sinai Peninsula, almost no one was untouched by the violence.
According to Egypt's 2016 population figures, Rawda was home to some 2,100 people. Assuming those numbers had stayed relatively constant, it appeared that Friday's massacre would have killed about a quarter of the male population.
"We had to bury them in mass graves. In every hole, we would bury 40 or 50," said Khalil, who helped lay entire families together. "People were silent, motionless, unable to grasp the reality of what had happened."
The massacre inspired acts of kindness. Community members arrived in droves at a hospital to donate blood, first-aid kits and all the painkillers they could afford.
Egyptian security forces have been battling the militants since 2011, when the group — then known then as Ansar Bayt al-Maqdis — initially trained its firepower on Israel. But when the army overthrew Islamist President Mohamed Morsi in July 2013, the militant group shifted its sights toward Egypt's security forces, its attacks growing more deadly as state repression of the Sinai's Bedouin inhabitants worsened.
Since the militants' 2014 pledge of allegiance to the Islamic State, the government has worked to keep its war with extremists in the shadows. Journalists are banned from entering the area, amid frequent reports of militant atrocities and heavy-handed tactics by the army.
But local residents said that an attack had been threatened for weeks. "An ISIS member would stand at the entrance of the village, hand a piece of paper to a resident and ask him to deliver it to one of the Sufi scholars in the area," said a local journalist, who spoke on the condition of anonymity because of fears for his safety.
"The attack was never a surprise to the community here. It is the savagery that was," he said.
Experts on militancy in the Sinai have attributed the group's growing brutality to a rising number of members who do not have family ties to North Sinai, as well as the pressures that accompany affiliation with the Islamic State.
"When you call yourself ISIS, you have to start copying the more brutal attacks and showing you're in control," Gold said.
The dead were believed to be mostly Sufi Muslims, a branch of Islam considered heretical by many extremists. Some also may have had links to a tribe that had opposed the Islamic State's presence in the area. An edition of the Islamic State's al-Nabaa newsletter, published last year, featured an interview with one of the group's Egyptian cadres, who promised to "combat the manifestations of polytheism including Sufism."
Friday's attack brought that threat to a national stage.
His eyes glued to a state television broadcast Saturday, Mohamed Saleh, a pharmacist in Cairo, described the attack as a "lightning shock." "They targeted Muslims. They killed Muslims," he said. "Egypt has suffered a lot, but these are our cruelest years."