Led by a savvy commander, Egypt's powerful military returned to politics with a new look and a new approach. It built a coalition behind the removal of the president and rode a stunning wave of popular support.
Now after its troops killed at least 51 supporters of Mohammed Mursi, the military faces the question of how it can thwart a determined Muslim Brotherhood campaign to restore the toppled president without more heavy-handedness that could damage its image and undermine its support.
After the opposition protests of June 30, when millions of Egyptians took to the streets to call for Mursi's ouster, the military ramped up its ongoing charm offensive, tapping into widespread discontent with the Islamist president and pro-military sentiment among the Egyptian public.
To the wild cheers of demonstrators, jet fighters swooped low over Cairo, helicopters flew overhead - trailing giant Egyptian flags and drawing a heart in the sky with red smoke. The chants of “the army and the people are one hand,” rang out in Cairo's Tahrir Square.
It was a far cry from the resentment pro-democracy groups felt toward the military soon after the fall of Hosni Mubarak in 2011. The military was then accused of mismanaging the transition and of human rights violations, including torturing detainees and hauling more than 10,000 civilian before military tribunals.
It is a different army now with a different leadership.
The army officer who became Egypt's ruler in 2011 was Hussein Tantawi, a field marshal in his 70s who was Mubarak's defense minister for two decades. Tantawi often seemed out of touch with the new dynamics on the streets and showed little of the political acumen needed to run a country shaking off 29 years of authoritarian rule.
Enter Abdel-Fattah el-Sissi, a 58-year-old former chief of the military intelligence who was named army chief and defense minister by Mursi in August 2012, replacing Tantawi, his longtime mentor.
El-Sissi was widely expected to be beholden to Mursi, but that soon proved to be an incorrect assumption: The career infantry officer began delivering a series of subtle and not-so-subtle hints that the military was unhappy with the way Mursi and his Muslim Brotherhood were running the country.
What distinguishes el-Sissi from the usually dour army chiefs who preceded him is his energy and outreach. His carefully selected public appearances included a televised party dedicated to orphans and a meeting with icons of the local art and literary scene during a military function. And he was seen in combat fatigues jogging with his troops.
All the while, el-Sissi seized every chance to proclaim that the army's loyalty was primarily to the people, not anyone else - including Mursi and his Muslim Brotherhood.
El-Sissi's social skills and well-oiled publicity machine will need to move into an even higher gear if they want to maintain the army's popularity and undermine the Brotherhood.
The shootings Monday of Mursi supporters prompted questions about whether troops used excessive deadly force, an accusation the military dismissed as unfair.
“What excessive force? We were dealing with people shooting at us with live ammunition,” chief military spokesman Co. Ahmed Mohammed Ali told The Associated Press. “It would have been excessive if we killed 300.”
Confident in the army's position, Ali asked those at a televised news conference to stand in silence to mourn the dead. Later he expressed regret for the loss of life, but did not accept blame for the killings.
Still, the military took seriously the accusations it used excessive force and moved swiftly to debunk the version offered by the Brotherhood: that the victims were killed while praying and the dead included women and children.
The two sides spent most of the day fighting a “war of videos,” with each producing footage intended to show the other started the violence.
The independent and state media toed the military's line, blaming the Brotherhood for attacking troops and police as they moved to clear a sit-in by Mursi supporters. After the shootings, the networks only aired army footage of the clashes - videos that purportedly showed armed Mursi supporters targeting troops and police with live ammunition, birdshot and rocks.
The Brotherhood, meanwhile, using social networking sites and sympathetic TV networks, distributed video showing tens of thousands of Mursi supporters rallying in Cairo, some weeping hysterically, while speakers cried out about martyrdom and their fight against a brutal military dictatorship.
“We're still investigating how this started. I don't think the killings were necessarily intentional, but we've seen how the smallest spark can provoke an excessive lethal response on the part of the military,” said Heba Morayef, the Egypt director of Human Rights Watch. “We know that there were some guns also on the Brotherhood side.”
The killings led to calls for an independent investigation.
Al-Azhar's Sheik Ahmed el-Tayeb, one of Egypt's most revered religious figures, increased the pressure on the military, saying he was going into seclusion in protest and would not emerge from his home until the bloodshed ends. He also warned of civil war.
The military was also fending off critics who say its ouster of Mursi was a coup, and not, as many Egyptians believe, a move in support of a popular uprising.
The killings Monday do not help.
“The death of so many at the hands of the army will only support the perception that it was a military coup and that the army only knows the language of violence,” said Gamal Eid, head of the Cairo-based Arab Network for Human Rights. “The comments by the military spokesman betrayed the notion of the military in power and immune from accountability.”
Analysis: Egyptian military’s new look challenged