If, for a moment, the commanders of Egypt’s security forces had been inclined to pat themselves on the back in light of the decline in terror attacks in the Sinai, the string of blasts that rocked Cairo on Friday morning exposed the grim reality: the terror that hit the peninsula has not abated, but rather drifted westward and southward, to Cairo and other cities in mainland Egypt.

Between July and December 2013, there was a sharp and dramatic decline in the number of attacks against the Egyptian military in the Sinai. Six months ago, the number of shooting attacks averaged about 100 per month. In December, on the other hand, the number could be counted on one hand.

This significant transformation can be attributed to two factors — one positive, one negative.

The first is that the Egyptian army has made substantial gains in its war on terror in the Sinai in the last few months. Yes, many have lost their lives in the exhausting struggle against al-Qaeda militias, but Egypt’s intelligence and military forces have succeeded where they failed in the past. They have begun to lay the foundations for an intelligence network by recruiting sources and technologies. They have employed commando units, the air force and other military forces to harm or block al-Qaeda while continuing their determined offensive in northeast Sinai, particularly against the smuggling tunnels, most of which they have managed to block off. They have even convinced a number of local tribal leaders to spearhead campaigns encouraging militants to surrender illegal weapons. The third such campaign came to a close just this week, with impressive results.

However, the second factor, which is no less important, has particularly negative ramifications for the population of mainland Egypt. The terrorists who fled Sinai to escape Egypt’s military offensive there have begun in the past month to concentrate their activity deep inside the country, especially in Cairo.

On Friday morning, six Egyptian troops were killed and dozens more injured in four separate attacks. On Thursday, Egyptian security forces discovered a massive cache of explosives meant for Port Said. Earlier in the week, five Egyptian policemen were killed in Beni Suef – and that is just the tip of the iceberg.

The al-Qaeda-inspired Ansar Beit al-Maqdis, or Champions of Jerusalem, claimed responsibility for Friday’s attacks. The same group took responsibility for firing rockets on Eilat this week, and we can assume that Egypt and Israel have joined forces in the struggle against it.

The organization operates a network of terrorists, both Egyptian and foreign, and has managed to secure support among the Bedouin population of Sinai as well. The poverty and religious radicalization on the peninsula have made it fertile ground for recruiting militants. Moreover, Ansar Bayt al-Maqdis maintains close ties to the Hamas-run Gaza Strip, and some of its members receive assistance in the form of weapons and training from the Palestinian organization Jaish al-Islam, or Army of Islam, headed by Muhammad Durmush.

The anger Egyptians feel towards Hamas doesn’t stem only from its close ties to the Muslim Brotherhood in Egypt. It’s also because the Islamist organization turned a blind eye to the link between the Gaza-based Durmush and the Sinai-based Ansar.

In fact, Egyptian security forces stepped up their efforts against smuggling tunnels and terrorists in the Sinai precisely when they understood that the global jihad groups active on the peninsula were no longer content with targeting Israeli alone, and had expanded the scope of their activities to target the Egyptian military and Egypt’s most important strategic asset, the Suez Canal, as well.

This week’s escalation comes at a historic time – the three-year anniversary of the January 2011 uprising that ousted Hosni Mubarak. Three years have passed since the mass protests that transformed Egypt. Granted, the army has succeeded in stabilizing the new regime, and elections for the presidency and parliament are expected to take place later this year. And yet, protests against the regime led by Abdel-Fattah el-Sissi continue. Each day, hundreds – if not thousands – of Egyptians take to the streets to demonstrate against the ouster of the Muslim Brotherhood and its president Mohammed Morsi.

Friday’s attacks won’t help garner additional support for protests planned for Saturday and beyond against the military. On the contrary – the wider Egyptian public sees in the blasts a correlation between the Muslim Brotherhood and the terrorists, even though that may not be the case.

And yet, still, large swathes of the population do support the Brotherhood. So ultimately, without cooperation between the army and its sworn enemies, the Brotherhood, it will be difficult to stabilize the political and military situation in Egypt anytime soon.