In the past three years, widescale protests against an Egyptian president began to destabilise the country, with the demonstrations ending after an army intervention - twice. To understand Egypt's current predicament, it's important to look at the differences and the similarities between the two cases.
In any governing establishment, there is legal legitimacy and popular legitimacy; ideally, the two go together, but not always.
In most democratic regimes, the president, despite popular legitimacy, can have his legal legitimacy removed (by impeachment, for example). A lawful leader's popular legitimacy might be questioned and he might call for early elections. Winning at the ballot box is never the only thing that counts, whether it should or not. There are always other variables. It's not often, nor should it be, that a military gets to be one of those variables.
In February 2011, Hosni Mubarak, under pressure from the military and popular protests, resigned as president and transferred authority to the armed forces, in a legally and procedurally problematic move.
A number of activists and other public figures had called for a road map to be put in place before he resigned, to avoid such legal quandaries on the route ahead - although that would have been based on the assumption that the judiciary and the legal process in Egypt have full integrity and consistency, which is arguable, to say the least.
Early this month, the military, again, pressed the president to respond to the pressure of popular protests. A few things were certainly uncommon. For example, Mohammed Morsi had been voted president in a free vote, unlike Mr Mubarak, and had been in office for one year, as opposed to Mr Mubarak who had been in power for 30 years.
The critical point for the 2011 protesters was not whether Mr Mubarak was a democratically elected president; what mattered was that he was an awful president in a terrible system and that Egypt deserved better. When the protests began, the protesters were under no illusion that the majority of Egyptians were behind their demand he step down. But they did believe that the majority of Egyptians wanted a better life. By the time it was all over, polls showed that the overwhelming majority of Egyptians supported the protests. Moreover, the protests were creating instability in the country as they grew every day, and Mr Mubarak's popular legitimacy was in question.
But is that what led to the military intervention? And if a coup was ethically wrong in the first case, is it wrong in the other one? And if it was ethically right in one, was it right in the other?
The crux of the matter is what one considers to be more important. For supporters of Mr Morsi, the system is more important - legal legitimacy is more important than popular legitimacy, and that is their overriding concern. For supporters of the military takeover, popular legitimacy is more important. Both, however, can be accused of inconsistency.
In 2011, the Muslim Brotherhood did not object to the military takeover on the basis of the need for a legally legitimate road map. In fact, the Brotherhood threw their weight completely behind the military takeover, even to the point of fully endorsing its road map, while revolutionary forces denounced it.
Also, if there had been a trusted legal mechanism for calling for impeachment or for early presidential elections, the opposition of the day would certainly have utilised it.
On the other hand, many of those from the former regime who argued that the 2011 intervention was illegal and opposed the January 25 revolution in 2011 are the same people who were vigorously in support of a military overthrow in 2013.
For a small group of Egyptian activists, who disagree with either of these camps, there is one fundemental difference between 2011 and 2013: in the 18 days of Tahrir Square, they saw a pluralistic and cohesive society that could be a model for Egypt. That wasn't the case in the latest protests - and very few even realise that today, as the toxic discourse between different political groupings is intense and the loss of life on all sides continues.
Whether people like it or not, the military has overwhelming popular legitimacy. There are few institutions in the country that can compete with the level of confidence the army commands - over the past three years, confidence in the military was no lower than 88 per cent. While it is not a foregone conclusion, it is quite likely that the overwhelming majority of people at least tacitly accept the army's moves; considering the Brotherhood's opposition to the military now, however, confidence may be less than in 2011.
Legally speaking, army intervention is qualitatively as questionable today as it was in 2011 - maybe even more - because Mr Mubarak resigned while Mr Morsi refused to. Frankly, legal considerations are questionable in any case, unless everyone has complete faith that impartial processes are possible. The system itself is in serious need of an overhaul, particularly with regards to the judiciary, the security sector and the constitution. Such overhauls are arguably far more important than presidential or parliamentary elections.
Part of what is holding back any reconciliation process is the absence of popular faith in those institutions. If there were faith in them, the Brotherhood would feel far more comfortable admitting defeat because they might have a fair and impartial process to look forward to, rather than have to worry about persecution.
The military can claim popular legitimacy and the interim government has the freedom to enact any changes and reforms. The interim government needs to get one thing: ethical legitimacy. It won't find it by reverting to the former regime, as many fear it is doing, or by relying on the army or by returning to the "victory" of Egypt's squares on June 30. But they can find it in the pluralism and respect that embodied Tahrir Square in 2011.
Dr HA Hellyer, a non-resident fellow at the Brookings Institution and the Institute for Social Policy and Understanding, is based in Cairo
On Twitter: @hahellyer