President Abdel Fattah al-Sisi's government fears trouble along its nearly 700 mile border with Libya, as well as the potential for disaffected Egyptians to hone their skills in militant camps in its tumultuous neighbor.
In Libya, armed groups and Islamist militants who helped topple Muammar Qaddafi in 2011 are fighting for power. An Islamist-backed militia seized Tripoli, the capital, in August, set up its own parliament and left the internationally-recognized government and House of Representatives a rump state in the east, with the prime minister and his cabinet based in Bayda and the parliament in Tobruk.
Egypt, which promised not to intervene militarily, is joining Gulf allies in providing a mixture of public and covert assistance to favored groups.
Saudi Arabia, the United Arab Emirates and Egypt are viewed as having a common goal in trying to contain political Islam in the country and have thrown their weight behind the largely secular Tobruk government, and a breakaway faction of the Libyan military that is waging an anti-Islamist campaign around the eastern cities of Benghazi and Derna.
“The Egyptian authorities view Libya very much through the eyes of their own experience within Egypt,” says H.A. Hellyer, an Associate Fellow in International Security Studies at the Royal United Services Institute in London.
Egypt's leaders tend to be deeply anti-Islamist, which has been exacerbated by a militant insurgency that emerged after President Mohamed Morsi from the Muslim Brotherhood was deposed in 2013
Hundreds of security personnel have been killed in the space of a year, and Egyptian troops in the restive North Sinai region are now locked in a battle with fighters from the Islamic State-inspired Ansar Bayt al-Maqdis group. Last month, Mr. Sisi described the fight as "existential."
Egypt’s publicly-declared assistance to Libya has focused on increasing the abilities of its ragtag police and army. Last month, Egyptian Prime Minister Ibrahim Mehleb said the interior ministry would train Libyan forces to fight terrorism and help secure the shared border.
"We need to urgently support all the needs of our [Libyan] brothers to coordinate at the highest level in all areas... in the fields of security and we emphasize the exchange of information to combat terrorism,” he told a news conference. According to Western diplomats, this also includes logistics and intelligence support along the border.
Egypt is particularly concerned over reports that domestic militants have traveled to Libya for training. Much of the country’s eastern border areas are unpoliced, providing fertile soil for jihadis.
“They can move freely in those areas and they can seek help there,” says Mohamed Eljarh, a nonresident fellow at the Atlantic Council’s Rafik Hariri Center for the Middle East. According to Mr. Eljarh, militant networks are also entangled with those of people smugglers, who provide forged visas and passports to the militants for a fee.
More secretively, Egypt has also been cooperating with its Gulf allies to help renegade General Khalifa Hiftar and his self-declared Operation Dignity in an anti-Islamist campaign in the east of the country.
In August, American officials said that UAE pilots flying out of Egyptian air bases twice targeted Islamist fighters vying for control of Tripoli. And last month, the Associated Press reported that Egyptian planes - manned by Libyan forces - had been used to bomb Islamist positions in Benghazi.
Egypt has strenuously denied both claims, though that hasn't convinced all observers. “It's no surprise that the Egyptians and their allies are doing this in a very secretive and ambiguous way,” says Mr Eljarh. “They have signed formal agreements to say that they will not intervene. But Egypt will not sit idle while its own national security is being threatened by what is going on in Libya.”
Qatar is also said to have played a role in this battle. As well as openly funding and arming jihadis, it has allegedly sent a C-17 cargo plane to provide arms to Islamist militia.
According to Dr. Hellyer, there are mixed feelings in Cairo over Gen. Hiftar’s strategy. “On the one hand, there is a clear direction of support for the fight against radical Islamists like Ansar al-Sharia in Benghazi. On the other, there is less confidence in the actual person of Khalifa Heftar – as such, if he goes, but the operation continues, there won’t be much grumbling,” he says.
Paradoxically, some believe the military campaign that Egypt is backing may have increased the Islamist threat, rather than weakened it.In a recent briefing paper, Frederic Wehrey from the Carnegie Endowment for International Peace argued the campaign had compelled Islamist militias in Benghazi to combine their firepower into a single coalition. He said this was “undermining the political space for more pragmatic Islamist factions.”
Either way, the battle continues.
Over the weekend, clashes continue to rage in Benghazi's southwestern districts - local observers said they were expected to intensify as Hiftar's forces push west into neighborhoods where the Islamist-led militia have more support.