WHEN Muhammad Morsi was elected president of Egypt a year ago, this newspaper was wary. As fervent supporters of liberal democracy, we are uncomfortable with the belief of the Muslim Brotherhood, Mr Morsi’s party, that politics are subsidiary to religion, and are downright hostile to the attitudes towards women and minorities that pervade the Islamist movement. We would have preferred the secularists who led Egypt’s revolution to have won. Yet we recognised that Mr Morsi’s 52% of the vote—a stronger endorsement than Barack Obama got five months later—gave him the right to rule. And, most of all, we were delighted that after 30 years of dictatorship, Egypt was on its way to becoming a democracy.

That is why we regard the events of the past few days with trepidation. Mr Morsi’s ouster by a combination of street power and soldiers sets a dreadful precedent for the region. The army, which is in part responsible for the situation, must start Egypt on the path towards new elections as swiftly as possible, or the prospects for the country will be bleak.

Post-Morsem

Mr Morsi’s rule started unravelling when crowds massed in the streets of Egypt’s cities on June 30th, the first anniversary of his time in power. The protests turned violent; the Brotherhood’s headquarters were burned; 48 people have died. On July 1st, the army gave Mr Morsi 48 hours to resolve his dispute with his opponents. Mr Morsi responded by defending his legitimacy and refusing to step down. On July 3rd, the chief of army staff, General Abdel Fattah al-Sisi, announced that the constitution had been suspended. Mr Morsi was taken into military custody.

Most of the blame for the disaster that has befallen Egyptian democracy lies with Mr Morsi. The very size of the protests—some estimates claim that as many as 14m took to the streets—shows that his opponents were not a small bunch of discontents. Most of the country seems to have turned against him. One reason for that is his incompetence. He did nothing to rescue the economy from looming collapse. The Egyptian pound and foreign exchange reserves have both dwindled, inflation is rising and unemployment among those under 24 is more than 40%. The IMF has despaired of agreeing on a big loan that would have opened the way to others. In the broiling summer heat, electricity cuts have become maddeningly frequent. Queues for petrol have lengthened. Farmers are often not being paid for their wheat. Crime has soared—the murder rate has tripled since the revolution.

The Brothers’ failure to include a wide range of views in its first government was even more foolish. Egypt, at the best of times, is hard to govern because society is polarised. Secular-minded and better-educated Egyptians generally want the country to be dragged into a modern, pluralistic and outward-looking world. A more conservative and religious stratum looks to political Islam rather than socialism or capitalism as the answer to centuries of injustice, inequality and corruption. In addition, Egypt has a large and nervous minority of Christians, perhaps a tenth of the populace of 84m, along with a much smaller minority of Shia Muslims, both of whom have been rattled by an Islamist government.

Instead of trying to build up the independent institutions—the courts, the media, a neutral civil service, army and police—that check the power of government in mature democracies, Mr Morsi did his best to undermine them. He legislated through a senate that was elected by only 10% of the voters. He made false, inept or cowardly choices at every turn, finagling constitutional issues, pushing fellow Brothers into key appointments and feeding the secularists’ fears that his brethren were determined, by hook or by crook, to Islamise every aspect of society. He stayed silent when bigots and thugs threatened and attacked religious minorities. He allowed foreigners working for advocacy groups promoting human rights and democracy to be hounded, prosecuted and convicted (most of them in absentia) on patently false charges.

That so many Egyptians should wish to get rid of Mr Morsi is therefore entirely understandable. That they have succeeded in doing so could well turn out to be a disaster, and not just for Egypt.

The precedent that Mr Morsi’s ouster sets for other shaky democracies is a terrible one. It will encourage the disaffected to try to eject governments not by voting them out but by disrupting their rule. It will create an incentive for oppositions all over the Arab world to pursue their agendas on the streets, not in parliaments. It thus will reduce the chance of peace and prosperity across the region.

It also sends a dreadful message to Islamists everywhere. The conclusion they will draw from events in Egypt is that, if they win power in elections, their opponents will use non-democratic means to oust them. So if they are allowed to come to office, they will very likely do their damnedest to cement their power by fair means or foul. Crush your opponents could well be their motto.

How to make it less bad

That damage is done, and cannot be undone. But there are better, and worse, ways for the story to unfold. If the army holds on to power, then Egypt will be back where it was before Hosni Mubarak was ousted—but without the hope that prevails before revolution has been tried and has failed. If the army announces a timetable for elections and sticks to it, then Egypt has a chance. The soldiers will need to make credible promises to the Islamists that if they win (which, given their performance over the past year, the Brothers are unlikely to) they will be allowed to take power. Persuading them of that will be hard: holding an election quickly would help.

Egypt’s army played a pivotal role in the revolution, standing by while people power pushed Mr Mubarak out. It still has the trust of many Egyptians, who are still inclined to turn towards it in times of crisis. If the generals are to repay that trust, they must get the country back on the path towards democracy as swiftly as possible.