BARELY a week ago Muhammad Morsi, Egypt's president, was basking in praise for helping forge a truce in neighbouring Gaza. Today he rules, shakily, over a bitterly polarised nation. On November 27th a gathering as vast as any since the heady days of Egypt's January 2011 revolution choked the centre of Cairo in a cacophony of protest against a man they now condemn as a new dictator. Not only has the uncowed president vowed to raise still bigger rival crowds. His embattled camp is rushing out a controversial, hastily concocted and Islamist-hued draft constitution for approval in a general referendum. Five months into his term, seeking to capitalise on his Gaza success and to break a festering deadlock with secular opponents, Mr Morsi issued a shock, six-part decree that granted sweeping new powers to his office. The move has pitched Egypt into its gravest crisis since the uprising that ended six decades of military-backed dictatorship. It has united the hitherto bickering secular opposition, which plans to protest until he revokes his decree. It has sparked a slide of nearly 12% in an already battered local stockmarket. And it has prompted a strike by Egypt's judges, who would normally be responsible for overseeing a constitutional referendum. From the perspective of the president and those who have fallen in line with him, most notably the Muslim Brotherhood and fundamentalist Salafist groups, his action was understandable. Mr Morsi won office in June with a slim 51.7% of votes. Yet the Islamists, who together had gained a more convincing majority in earlier parliamentary polls, have been frustrated in converting a win into tangible change. Worse, Mr Morsi's government has soaked up blame for unimproved government services and a feeble economy. Strapped for cash, it may soon have to resort to harsh austerity measures even as a next round of elections looms. The Islamists sensed a narrowing window of opportunity. As they see it, an array of malevolent forces have combined to thwart them. These include not just secularists and Egypt's large Christian minority, but also foreign powers, an irreverent and often hostile press and stubbornly obstructionist chunks of Egypt's colossal state bureaucracy. Bolstering all these is the moneyed elite that built its wealth under the ousted regime of Hosni Mubarak. Egypt's judiciary has been especially difficult. In spring a court disqualified the Brotherhood-dominated parliament's first choice of a constituent assembly, a body charged with drafting a new constitution. Only days before Mr Morsi's inauguration, the most senior constitutional court infuriated the Brotherhood by ruling, on a technicality, to disband the parliament itself. Egypt's judges united in October to block Mr Morsi from firing the public prosecutor, a powerful Mubarak-era appointee who had failed to fulfil popular demands for "revolutionary" justice. Mr Morsi hoped, by issuing his commands, to sweep all these challenges aside at once. There was little protest at some parts of the decree, such as the second attempt to sack the public prosecutor and to allow for retrials of former regime henchmen. But Mr Morsi had promised to make light use of the legislative powers that he wields in the absence of a parliament. Instead, with no public discussion and scant advice from his own aides, the president ruled not only to block any future court challenges to the legality of the constituent assembly. He also awarded blanket legal immunity to himself, until such time as a new constitution and parliament impose some binding limits. The constitutional court was due to rule soon on the legality of the second, again Islamist-dominated, constitutional assembly. Its legitimacy had been challenged by the mass resignation of Christian representatives, women and secularists, but the body retains a slim, albeit solidly Islamist quorum. Prompted by the outcry against Mr Morsi's decree, the rump assembly quickly conceded to controversial demands by Egypt's powerful army, such as that the defence minister should not be a civilian. Mr Morsi's camp now say the 230-article draft constitution is ready to go, ignoring protests by trade unions, churches and legal experts, among others, that it is unclear in parts, unfair in others, and grants overmigthy executive powers. Brotherhood supporters insist that the expanded powers are strictly for the public good. Mr Morsi has made conciliatory speeches, declaring himself proud to govern a country with a strong and vocal opposition. His moves were needed, he said, to create the environment Egypt needs to secure revolutionary goals, to build democratic institutions and to get its economy back on track. Vowing to purge the state of "worms" that have undermined it, Mr Morsi swore to uphold the freedoms he had spent his own life fighting for. Mr Morsi seems to have forgotten the sensitivity that a country freshly freed from decades of despotism might feel towards anything with an odour of dictatorship. Secretive and inward-looking, the Brotherhood appears surprised by the depth of mistrust that many Egyptians, including pious Muslims of every social class, feel towards them. The Islamists" constituency remains large and their organising power formidable. "They will rally the poor with the slogan: to be a Muslim, vote yes for the constitution and confound the infidels," predicts Muhammad Nour Farahat, a law professor at Cairo's Zagazig University. Yet even if Mr Morsi and his Brothers manage to pull this off, a heavy cloud will remain over their rule.