A wave of deadly attacks on soldiers in Egypt's Sinai has exposed Cairo's floundering strategy against jihadist insurgents in the peninsula despite an unprecedented offensive.
After carrying out their first attacks following Egypt's 2011 uprising that ousted Hosni Mubarak, militants launched a campaign against the government in earnest after the overthrow of Islamist president Mohamed Morsi in July 2013.
Scores of Egyptian soldiers and police have been killed since then-defence minister Abdel Fattah al-Sisi, now Egypt's president, ousted Morsi.
The main jihadist group, Ansar Beit al-Maqdis, pledged allegiance to the Islamic State group in November — apparently bolstering its ability to conduct major attacks despite the mobilisation of thousands of troops in Sinai.
Last week saw one of the deadliest attacks to date, with militants launching coordinated assaults that spanned the capital of North Sinai and several towns, killing at least 30 soldiers and police.
The attack prompted a fierce response from Sisi, who vowed the army would no longer hold back and promised a "hard and hellish" battle.
Sisi, who also urged officers to safeguard civilian lives in an address on Sunday, had previously shaken up the army command in the strategic peninsula and pledged more funds to support the military.
But after an intense campaign against the insurgents, the military appears no closer to rooting them out.
The jihadists, led by Bedouin militants and a mysterious cleric known as Abu Osama al-Masry, have taken advantage of the peninsula's inhospitable desert and mountains to elude the overstretched army, analysts and officials said.
– Boosted by IS links –
In some parts of North Sinai, jihadists have even set up impromptu checkpoints, stopping suspected policemen and informants and executing them.
"The Sinai is a very difficult operating environment, even for the Egyptian army," said Aaron Reese, the deputy research director at the Washington-based Institute for the Study of War.
"The spread-out terrain makes it easier for militants to mass in the desert, and then strike at isolated outposts," he said.
The jihadists have been bolstered by arms smuggled in from Libya and munitions seized in an attack on a checkpoint in October that killed 30 soldiers.
In Thursday's attack, which involved a suicide bomber and mortar fire on military and police bases, the jihadists used mortars seized from the army checkpoint in October, interior ministry spokesman Hany Abdel Latif told AFP.
The military last week retrieved at least one of the mortar pieces in a raid that also killed three militants.
Several Ansar Beit al-Maqdis senior commanders have been killed over the past year and police have all but eradicated the group's cells in the Nile Valley and along the western border with Libya.
But in Sinai the jihadists appear to have adapted, possibly boosted by funding and training from hardened IS operatives who have years of experience fighting US and Iraqi troops.
"The one area that their coordination with the Islamic State seems to have improved their capacity is in bomb-making," Reese said.
"There are probably one or two Islamic State commanders who returned to Sinai to structure and organise the group," said Mathieu Guidere, who teaches Islamic studies and politics at the University of Toulouse.
The militants say they want to impose an austere interpretation of Islam and have beheaded and shot dead several suspected Bedouin informants, sparking resentment from many in Sinai.
But the army's tactics — including razing hundreds of homes to build a buffer zone along the border with Gaza — has also fed into longstanding resentments against the central government in Cairo.