Egyptians have learnt that democratic transitions are messy, inexplicable affairs.

In January 2011, the country’s squares, particularly its iconic Tahrir, were stuffed with people demanding bread, freedom and social justice. It was a victory against an oppressive regime, desired by the people, backed by the army. A year later, in the face of growing human rights abuses, the people crowded the squares demanding that the army relinquish its caretaker status and make way for a democratically elected president. And a year after that, the squares have once again filled with people, demanding the ouster of that same democratically elected president, with the backing of the army.

Egypt’s head of the armed forces, Abd El-Fattah al-Sisi had presented President Mohamed Morsi and Egypt’s opposition forces two weeks earlier with a grace period to solve their differences. On July 1, he presented Morsi with a forty-eight hour ultimatum to step down, which resulted in a defensive and breathtakingly aggressive speech by the president in which he consistently stressed the legitimacy of his presidency and warned of impending violence if he were overthrown. On July 3, 2013, the army announced a "roadmap" for Egypt’s transition, which included an interim president, a suspended constitution and a new government.

There are good reasons why Egyptians would celebrate the ouster of their first ever democratically elected president. During his time in office, Morsi and the Muslim Brotherhood, from which he hails, have made almost every mistake possible. After eight decades of being a resilient and adaptable opposition, it lost its head when faced with the acquisition of real power. It executed several naked power grabs (the worst of them a constitutional declaration which gave Morsi almost unlimited powers) it refused to take note of the wide spectrum of Egypt’s society and political players, consistently appointing Muslim Brotherhood members or sympathisers to positions of power. It made a mockery of the constitution-writing process, shoving out almost all outside players, finally ramming through a flawed document tailor-made for their interests. It managed to alienate almost all of Egypt’s institutions; the police, the army, the judiciary. It has attempted to strangle freedom of expression through consistent legal attacks on the media. And it has managed to ignore sectarian issues, always dangerous in Egypt and particularly so in the face of claims that it stoked sectarian strife.

It may be likely, however, that the final nail in the Brotherhood’s coffin was its enormously inept handling of Egypt’s economy. This would have been a tall order for the most skilled public servants but Brotherhood insistence on its own, unqualified, cadres and its ability to ignore any outside advice meant that Egyptians have had to endure a 13 percent unemployment rate, rising poverty, repeated power and fuel shortages and rising food prices. In short, the leadership of the Brotherhood wanted power, had no idea how to wield it and refused to respect their limitations. They must bear the brunt of the responsibility for what has happened. To all intents and purposes, Egypt has just seen a military coup but it would never have happened if there were not overwhelming mass public support. After sixty years of ruling from the background, the army found its stint as overt ruler messy and violent and it’s highly unlikely that it would have risked a repeat if it had been unnecessary. It is in the army’s interests to have a socially, politically and economically cohesive Egypt and it is the only institution in the country with the power to effect that kind of change.

The fact remains, however that no matter how incompetent Morsi and the Brotherhood were, Egypt has just witnessed the ouster of a democratically elected president. And while the Islamists’ insistence on the supremacy of the ballot box might be monotonous and self-serving, it cannot be ignored. The ouster has given them a legitimate grievance and a reason to ignore the democratic process in the future. The Brotherhood isn’t going anywhere, the question is merely how it will choose to operate in the future.

Mirette F. Mabrouk is the deputy director for regional programs at the Rafik Hariri Center for the Middle East.