On Sunday President Mohamed Morsi issued a new constitutional declaration making major changes in Egypt’s current balance of power. According to the new declaration, the president now enjoys all powers that were vested in the Supreme Council of the Armed Forces (SCAF), including legislative. The president sent the defense minister and general commander of the SCAF, Field Marshal Hussein Tantawi, the chief of staff of the armed forces, General Sami Anan, and the heads of the air force and navy into retirement. Although the reshuffle comes in the aftermath of a major a assault by militants in Sinai, it is unrealistic to think of the latest security arrangements as spur of the moment choices in reaction to the attacks. The president’s decisions probably have been brewing for some time given the careful selection of succeeding generals.

The recent changes may be the most important military purges since former President Anwar Sadat’s elimination of the "power centers" in the early 1970s. Faced with mounting opposition to his presidency, Sadat often collided with his predecessor, Gamal Abdel Nasser’s generals especially Minister of Defense Mahmoud Fawzi, head of General Intelligence Ali Sabri, and Minister of Interior Sha’rawi Goma. The strong men showed limited loyalty to the then new president and worked to curtail his powers. However, Sadat managed to depose of the disloyal generals when a window of opportunity opened in 1971. Communication between the president and his second tier generals had been crucial to the success of the purge. Morsi’s recent efforts bear many similarities to the process that took place four decades ago.

Morsi’s legal powers were limited when the SCAF amended Egypt’s constitutional declaration last June. The amendments stripped the incoming president of the power to appoint military personnel without the SCAF’s approval. It also mandated that in the absence of an elected parliament, only the SCAF would hold the power to legislate. In a tug-of-war over legal means, the new president needed to issue another declaration to annul the earlier one. There is no doubt that Morsi and his advisors were preparing to issue another constitutional declaration, but waited for the right time in order to prevent further inflammation of the already delicate domestic situation. After all, the elected president only won a quarter of Egypt’s voting power, and an unhappy public would have made such legal steps costly for him. The recent attack on Egyptian soldiers and the political embarrassment it caused to the military provided an opportune moment for Morsi to recapture the presidential powers.

On August 5, 35 militants attacked a security post on the Egyptian border with Gaza. The attackers struck at sunset when Egyptian soldiers were breaking their Ramadan fast, killing 16 soldiers and stealing two armored vehicles before fleeing toward the Palestinian side. When Israeli intelligence officials declared that they knew about the possibility of an attack and passed some information to their Egyptian counterparts, General Mowafi publicly admitted that he informed his superiors, Field Marshal Tantawi and General Anan. Mowafi added that he could not believe that a Muslim would kill a fasting Muslim in Ramadan. The chief spy’s comments inflamed the public who questioned the preparedness and competence of the security sector. Two days later, President Morsi sent Mowafi to retirement, dismissed General Abdul Wahab Mabruk, the governor of North Sinai, and ordered the first military air strikes in Sinai in 40 years, targeting terrorist cells that have been growing over the past 18 months in the peninsula.

Although Morsi’s military reshuffle can be partially understood in light of the Sinai attack, the security arrangement around the funeral of the slain soldiers may have played an equally important role in prompting the president to hasten the changes. In recognition of its fallen members, the military had planned for the funeral to take place in its main mosque in Cairo’s Nasr City quarter. President Morsi, Field Marshal Tantawi, General Anan, Prime Minister Hisham Qandil, and other high officials and dignitaries were to attend. At the last minute, the president changed his plans and refused to show up. His spokesperson later declared that members of his Freedom and Justice Party (FJP) informed him that adequate measures to ensure his safety were lacking. Although Morsi received assurances from the military police to the contrary, he ultimately relied on the intelligence of the FJP. Party youth, who gathered in and near the mosque, noticed an influx of angry pro-Mubarak protesters and anticipated a possible attack on the president. Indeed, most Islamist figures, including the newly appointed prime minister, were verbally and physically assaulted at the funeral.

The incident showed the selective inability of the military police to protect the highest government officials. While all military generals and non-Islamist politicians remained untouched, Prime Minister Qandil was ultimately rushed from the scene under the protection of his bodyguards in an attempt to escape the barrage of shoes that were thrown at him. Morsi’s absence from the service exposed him to strong criticism from activists and journalists. And in reaction to the funeral fiasco, he asked Tantawi to remove General Hamdi Badeen, the head of the military police. The president seemed to consider the attack on his handpicked prime minister as an attack on him. Despite the president’s orders, military officials said that General Badeen would not be sent to retirement but would be given another post that would benefit from his expertise.

In a sense, the combination of the Sinai attack and the security failure of the funeral may have been the straw that broke the camel’s back. The calls from the public for improved security enabled the president to annul the constitutional amendments and reclaim his authority over military appointments. The new appointees included General Abdul-Fattah el-Sisi who will succeed Tantawi, heading both the ministry of defense and ministry of war production, and General Sedki Sobhi who will replace Anan as the new chief of staff. General Mohamed al-Assar was given the title of assistant defense minister. The appointments reveal Morsi’s understanding of key posts within the military and the needs of the transitional period. Sisi, who is almost two decades Tantawi’s junior, headed the military intelligence, the unit responsible for monitoring officers and their political views, while Sobhi headed the third field army based in Suez. Although Assar was not assigned a new position, his promotion formalizes his de facto role. Throughout the transitional period, Assar has proven to be a professional soldier with a likeable character and good communication skills. This enabled him to hold successful talks with international partners, in particular the United States, as well as domestic political forces. All three generals have been members of the SCAF, which indicates that the president consulted with his generals before ousting Tantawi and Anan.

In keeping with the Egyptian informal tradition of honoring deposed foes, the president awarded Tantawi and Anan the highest Egyptian medals and appointed them as his military consultants. Given Tantawi’s old age, and his and Anan’s close ties to Mubarak, their new positions will be more ceremonial than real; it is unlikely that Morsi will consult them on any pressing matters.

The tense relationship between Morsi and Mubarak’s upper brass resembles Sadat’s experience with Nasser’s loyalists in the military in the early 1970s. As new presidents, both Sadat and Morsi stood on shaky grounds, even despite their legitimate ascension to power. Sadat was Nasser’s vice president and the second in command according to the succession rules, but he lacked much of Nasser’s charisma and therefore seemed less qualified as a president. Morsi faces similar challenges. Because he was the second choice of the MB in the presidential elections and won with a marginal victory over Mubarak’s disciple, General Ahmed Shafiq, many of his opponents feel that he lacks the political character necessary to rule the country.

Also like Sadat, Morsi’s success in cultivating loyalty to his presidency depends, in part, on his ability to maintain the coherence of the military establishment and relationship with his second-tier generals. It may be hard to judge how the officer corps has received Morsi’s decisions, but independent news outlets and social network sites show that activists and politicians from different political backgrounds welcome them. The popular support alone should minimize possible internal opposition within the establishment as long as the president attends to the institutional interests of its members.

But Morsi faces a different military with a different set of challenges from that of Sadat. The late president confronted strong opposition from the head of the general intelligence and the defense minister, yet the defeat in the 1967 war with Israel made the officer corps yearn for higher levels of professionalization and lower levels of involvement in political life. Sadat promised them better equipment and training through re-orienting the country’s ties with the West. Morsi, on the other hand, may be facing a stronger and more professional military and can offer little in terms of improving its equipment and training given the country’s deteriorating economy. In fact, the ties between the Egyptian military and the Pentagon have been so well institutionalized over the past 30 years that any president can offer little to improve this relationship. Morsi’s best offer to the military may be to keep the institution’s economic assets intact and to foreclose queries into its engagement in trials of civilians especially under Mubarak. The current military may enjoy economic independence but officers may prefer to step away from the daily management and pay more attention to the turbulent situations on Egypt’s borders.

Sunday’s decisions show that the new president is making a consistent effort to reshape the security sector apparatus, instating officers who are more loyal to the new presidency than to the old regime. In addition to changes within the military and the intelligence leadership, in early August a new minister of interior with little affiliation to the Mubarak regime was sworn in. The new appointees are expected to show more loyalty to Morsi as the elected president of the country even if they are not MB loyalists. The appointed leaders were SCAF members prior to the 2011 revolution, and both Mubarak and Tantawi were careful to swiftly remove Islamists from the rank and file. In his capacity as the head of the military intelligence, Sisi was in charge of monitoring potential political activities of officers; it is foreseeable that he will continue with the same policy as the new minister of defense. Whether Morsi will work to instate Islamists in the office corps or pick MB sympathizers as his military generals remains a question for the future.

Like Sadat, Morsi may prove to be more politically shrewd than first anticipated. The current president won one more battle in the war against the Mubarak regime, but there are no guarantees that his decisions will be in the interest of a democratic transition given the concentration of legislative and executive powers in his hand.

The battle for the new constitution remains the real battle for democratic change.

Dina Rashed is a PhD candidate in political science at the University of Chicago. Her research focuses on authoritarian regimes, armed actors, and civil-military relations.