Court rulings throw Egypt into state of flux
Voting in the run-off for Egypt's landmark presidential election over Saturday and Sunday should have marked the final stage in the country's tumultuous democratic transition following last year's popular uprising.
Instead two decisions made by the Supreme Constitutional Court have thrown the political scene into a new state of flux and confusion.
A political exclusion law passed by the new parliament barring many former government figures from running for office was deemed invalid.
Had it been upheld, Ahmed Shafiq, Mubarak's last prime minister, would have had to drop out of the presidential race in which he faces the Muslim Brotherhood contender, Mohammed Mursi.
"The message of this historic verdict is that the era of political score settling has ended," Mr Shafiq jubilantly told his supporters gathered in a hotel on the outskirts of Cairo.
Another court ruling dissolved the Islamist-dominated parliament produced by what were widely seen as free and fair elections that took place between November and February.
The law used to organise them was found to be unconstitutional. As the Brotherhood controlled the biggest bloc in the legislature, it was left reeling.
In a statement, it predicted "very difficult days" ahead and warned that "all the democratic gains of the revolution could be wiped out and overturned with the handing of power to one of the symbols of the previous era".
Mr Mursi pledged to continue with his presidential bid at a late night news conference. He suggested there were plots to undermine the success of the forthcoming elections.
"If there is any forgery, there will be a huge revolution against the criminals… a huge revolution until we realise the complete goals of the 25 January Revolution," he said.
Some Brotherhood activists express hope that the situation can be turned to their advantage amid public suspicion that the ruling Supreme Council of Armed Forces (Scaf) and remnants of the former government are trying to stay in power.
Yet many analysts believe that the court decisions now make a win for Mr Shafiq even more likely. The former air forces commander is widely seen as the unofficial candidate of the generals who took power after President Mubarak was forced from office in February 2011.
"It will encourage support for the Scaf's favourite," says Cairo University politics professor, Mustafa Kamal al-Sayyid.
"The future president, most probably Shafiq, will now have a free hand to rule in the absence of the parliament," he adds.
"Both decisions empower the Mubarak status quo, which is no surprise as the judges of the court were appointed by the latter and represent a part of the so-called 'deep state,'" says Omar Ashour of Exeter University and the Brookings Doha Centre.
He places the rulings in the context of "the aftermath of a revolution that toppled Mubarak, but not his regime".
Legal decisions have already had a profound effect on the election process.
The Presidential Election Commission, an appointed judicial body earlier disqualified two Islamist candidates and the former head of intelligence from the presidential vote.
The head of the commission is Farouk Sultan, who is also president of the Supreme Constitutional Court. He was a Mubarak appointee.
According to Nathan Brown of the Carnegie Middle East Centre, "since Sultan had a career that stretched through both military and security judicial bodies, revolutionary forces and the Brotherhood deeply distrust him".
Revolutionary groups have been meeting to discuss their response. A few hundred demonstrators also gathered in Tahrir Square shouting "Down, down with military rule".
The inflammatory court rulings came a day after the Justice Ministry announced a highly controversial decision allowing army personnel to arrest civilians, a power they lost when decades-old emergency laws were lifted at the end of last month.
"It's confirmation that there's no intention to end the involvement of the military in law enforcement. This will allow the continuation of military trials for civilians," says Heba Morayef, the Egypt researcher for Human Rights Watch.
"Obviously there's now an expectation of protests."
Both Mohammed Mursi and Ahmed Shafiq took just under a quarter of the total votes in the first round of the presidential vote last month.
It produced a polarising run-off choice that has left Egyptians weighing fears of a return to the Mubarak era against fears of an Islamist takeover.
Mr Shafiq has pledged to end chaos and return order and stability. He has support from leading businesspeople, members of the Coptic Christian minority and others who hanker for stability.
Meanwhile, Mr Mursi has relied on his powerful Islamist organisation's grassroots network and is looking to ultra-conservative Salafis for their support in the next round. He has struggled to win over those who previously supported more centrist candidates.
Whichever man wins will inherit a difficult security situation, a struggling economy and a nation that now seems bitterly divided.
The powers of the new president remain undefined after a deadlock over the process of writing a new constitution. Parliament was tasked with setting up a committee to carry out the task.