IF YOU WERE Egypt’s president, what would you do if millions of Egyptians poured into the streets demanding that you go? During his election campaign last year Muhammad Morsi said that no one would demonstrate against him because as president he would faithfully represent the people’s will. “But if they do,” he added firmly, “I would be the first to resign.”

Egypt’s first ever freely elected president did not resign, even when his capacity to govern evaporated as perhaps 10m people across the country took to the streets at the end of June to scream for his departure. Instead, like his predecessor, Hosni Mubarak, only 30 months earlier, Mr Morsi had to be deposed by the Egyptian army. It was as if the Arab spring had never happened: the first of a new generation of leaders, as well as the generals, behaved much as their predecessors did.

This does not look like progress. The abrupt unseating of Mr Morsi would seem to be setting a far more ominous precedent than the ousting of the country’s last ageing tyrant. And the rude awakening for the Muslim Brotherhood, stripped again of power held only briefly after such a long wait, would seem to be flashing a danger signal to other ambitious Islamists.

Yet the reprise of Egypt’s revolution is not as strange as all that, and may presage aftershocks elsewhere. The French revolution took ten years of convulsions before Napoleon emerged, and seven more decades before a stable democratic republic took root. In Russia reverberations after 1917 lasted five years; in Iran after 1979 more than three.

If Egyptians revolted a second time, it was partly because Mr Morsi’s government committed sins similar to Mr Mubarak’s. It tried to play the same bossy, patriarchal role but was even more inept. The Muslim Brothers turned out to be not something new but a relic from the past. They thought their Islamist dream would inspire the people, but it seems the ambitions of most Egyptians are for something looser-fitting, more individual and more stylish. Other would-be leaders, take note.

It is a shame that Egyptians have had to fall back on their army to sort out the mess. The men in uniform proved cruel and incompetent masters not long ago, during the transition from President Mubarak to President Morsi. But other Arabs consider Egypt lucky at least to have a patriotic and professional army, not a gangsterish militia such as Syria’s.

Egypt’s generals have also learned hard lessons in the Arab spring and moved quickly to seek cover behind civilian leaders and institutions. Few of those institutions work well and they face immense problems, with a new one—in the shape of a possible violent backlash from disgruntled Islamists—now looming. But the resilience and creativity of ordinary Egyptians, who are clearly ready to fight for the freedom they have tasted, are an inspiration to Arabs everywhere.

It will not be a straightforward journey. Even where change has started, the experience of politics as an open contest within commonly accepted boundaries is still novel, and in most cases those boundaries have yet to be set. The risk of a relapse into strongman rule remains high. For places where the move to proper public participation has long been frozen, such as Algeria and Saudi Arabia, any sudden thaw could cause an avalanche.

Faleh Abdel Jabbar, an Iraqi sociologist, gives warning that for now in most Arab countries “all the elements that theory says should build democracy are absent, and all those that should prevent it are present.” The middle classes are weak, clannishness prevails, and oil-soaked states see no need for consent from citizens they do not need to tax. That equation is changing, but it will take time.

Hope reinforced

Yet for all the pitfalls, the spirit of the Arab spring remains alive. Everywhere, to different degrees, barriers of fear have been broken. A generation ago Saadallah Wannous, a Syrian playwright, famously lamented that his people were “sentenced to hope”. Those hopes have strengthened and the sentence feels lighter. A recent region-wide survey of attitudes by the Arab Centre for Research and Policy Studies, based in Qatar, found that most Arabs see their revolutions as positive overall, are confident they will achieve their aims and consider democracy the best form of government.

Perhaps more strikingly, although most respondents described themselves as religious, a strong majority among Arabs say that governments should not use religion to win popular support. They also feel that no one has the right to condemn people for interpreting Islam differently, or for holding a different faith. Mr Morsi failed to understand that, and paid for it.