CAIRO (Reuters) - In October, Emad al-Din Abdel Hamid, a former army commando who had embraced Islamist violence, led a desert ambush against Egyptian police.
His decision illustrates a growing threat from ex-officers ready to turn their guns on the security forces.
Abdel Hamid, whose group Ansar al-Islam claimed the attack and hailed him as one of their leaders, was later killed in a retaliatory air strike. But his death has not discouraged more army officers and police from joining Ansar, three Egyptian security sources said.
The October attack was the group's first public claim, and the first appearance of the name Ansar al-Islam.
But the group, with links to al Qaeda, has history. It is part of an unnamed network that Egyptian security officials have accused of trying to assassinate a former interior minister in 2013 and of killing the country's top prosecutor in a car bomb two years later.
Today, Egypt is also battling Islamic State in the North Sinai region. Hundreds of soldiers have been killed there since 2013, when Abdel Fattah al-Sisi, a former army chief who is now president, seized power and vowed to crush Islamist militancy.
The shadowy network that Ansar is part of presents a more daunting national security challenge than the Sinai militants, intelligence officials say, since it is comprised of army officers and policemen who use their training in counter-terrorism and surveillance to attack the forces they once served.
"They're more dangerous than those in Sinai even though they're fewer in number," one security source said.
The interior ministry, which oversees the police, did not respond to requests for comment.
The military has also not commented. Sisi appointed a new military chief of staff a week after the attack and the interior ministry dismissed several high-ranking officials in an apparent reorganisation of the country's security command.
The three Egyptian security sources said that in recent months up to 30 more captains and lieutenants in the security forces have joined the Ansar network, which is headed by one of the country's most wanted men, former special forces officer Hisham al-Ashmawy.
"They've got stronger," an officer in Egypt's National Security service told Reuters. "New numbers have joined, they have new weapons ... they focus only on big operations, so they don't use up manpower or firepower."
Ashmawy has been mounting a recruiting campaign in recent years and that is now beginning to bear fruit in terms of numbers joining, two of the security sources said.
Like the other officials interviewed, they requested anonymity because of the sensitivity of the matter.
Egypt has had to contend with Islamist sympathizers in the armed forces for years. In 1981, army officers assassinated President Anwar Sadat, whose rapprochement with Israel angered much of the Arab world. U.S. prosecutors say Seif al-Adel, a former army colonel, helped al Qaeda plan bomb attacks against American embassies in East Africa in 1998.
In recent months, hundreds of members of the security forces have been discharged because of their political or religious affiliations, the security officials said. Reasons for dismissing officers included refusal to arrest protesters at a demonstration or anti-government social media posts.
Sisi faces a presidential election in March, but the political effect of the violence may be limited. The main opposition candidates have withdrawn, and in any case many Egyptians say they are angrier about soaring living costs than about militant attacks.
Only about a dozen heavily armed Ansar militants were needed to lure a police convoy into the Western Desert ambush on Oct. 20, a survivor of the attack said.
"We fell into a trap. We followed banana and orange peels discarded by militants, thinking they'd got careless and left traces," an officer who survived the attack said.
Three security sources told Reuters at the time of the attack that dozens of police officers and conscripts were killed. But the interior ministry denied that figure the next day and said 16 police and conscripts died, including some high-ranking officers.
Two sources in Egypt's General Intelligence Service said Ansar al-Islam had likely known about the police's movements in advance.
"We have information that Ashmawy was able to get hold of devices or somehow listen in on a network that officers use," one of the sources said.
The communications network had been secured in the months before the ambush with new wireless technology used only by the National Security branch, he said, so Ashmawy either "had a way of bugging it, or had got hold of one of the new devices."
The security sources said Ashmawy recruits selectively, usually via a network of former officers operating in small cells. But Ashmawy and Abdel Hamid's path to jihad is familiar to military intelligence officials.
Both graduated from Egypt's military academy in 1999, according to Abdel Hamid's family, and spent time in a special forces unit called Sa'aika, or Thunderbolt.
They were discharged in 2007 and 2006, respectively, after the army saw they had become more religiously observant.
Both men disappeared and became jihadists in the years of chaos that followed Egypt's 2011 Arab Spring uprising, according to Abdel Hamid's family.
Abdel Hamid came from a long family line of military and police. He became radicalised nonetheless, raising the suspicions of intelligence agents.
"He had started reading more deeply into religion," his mother, Sohair al-Gohary, said at the family home in Alexandria.
The army locked Abdel Hamid up for a month after he was found carrying Islamic books. In 2006 he was transferred to a civilian service job for several years, his brother Alaa Abdel Hamid said.
Abdel Hamid divorced, married a woman who wore the Islamic face veil, and then disappeared in 2013, relatives said, days before the Ashmawy network carried out its failed assassination attempt on the interior minister.
Abdel Hamid's family heard nothing of him until he was killed by Egyptian warplanes two weeks after the Western Desert ambush. Alaa recalled his brother's last words to him in 2013.
"He said: how can I serve in a military that tries me (for religious piety) ... or live in a country that doesn't follow God's law?"
During the October ambush, Abdel Hamid's skill at arms could be clearly seen, a policeman caught up in the firefight said.
"I saw Emad shoot an officer in the head from a distance even though the officer was taking cover behind a car," the policeman told Reuters, recalling the incident.