CAIRO, Egypt - Two days before the country is set to elect a new president, Egypt's Supreme Constitutional Court has ruled that the Islamist-dominated parliament must be dissolved and that former regime figures must be allowed to hold political office, effectively approving the candidacy of presidential hopeful and former prime minister Ahmed Shafik.
Thursday's rulings, accompanied by an announcement that Egypt's ruling Supreme Council of the Armed Forces (SCAF) would now oversee the writing of a new constitution, immediately raised fears of a thinly veiled military takeover.
Mohammed el-Beltagy, the vice-president of the Muslim Brotherhood's Freedom and Justice Party (FJP), called the sequence of events a "fully fledged coup" in a post on his Facebook page.
But Mohammed Morsi, the Muslim Brotherhood's presidential candidate, said in an interview with Egyptian channel Dream 2 that the Constitutional Court's decision to dismiss the entire parliament did not amount to a military coup.
"I love the military forces," he said.
Morsi also said that the court rulings indicated "there [are] some who seek, strive for, and plan ill against the people."
Live Box 2011111713397233347
The Brotherhood may decide to reject the court's decision entirely. Saad el-Katatni, an FJP member and speaker of parliament, said recently that Egypt's interim constitution gave no institution the authority to dissolve parliament.
At issue on Thursday was the way in which the People's Assembly was elected, which involved a hybrid ballot, two-thirds of which was meant for political parties and one-third for independents.
The Brotherhood pushed the military to change the rules at the last moment, opening the independent seats for parties, thus hemming in the power of former regime elites to run for election.
But that push now seems to have backfired, with the court ruling that the change to the hybrid system unfairly discriminated against independents.
It relied on that principle to declare those seats invalid, and an election rerun necessary.
At the heavily guarded court before the ruling was delivered, a few hundred protesters had gathered in the hot midday sun to call for Shafik's disqualification.
"[Shafik] is part of the counter-revolution," said Hana Mohammed, a 51-year-old housewife and protester. "If Shafik becomes president, that means there was no revolution."
Many protesters handed out stickers encouraging bystanders to boycott the vote or spoil their ballots, while others waved the flag of Egypt's revolutionary socialist movement.
At least twice as many military and riot police armed with shields and batons and backed by machine gun-mounted armoured personnel carriers faced the protesters from behind a barbed-wire fence.
"It's not a good sign that the Supreme Constitutional Court is supposed to be independent and is guarded by state security and the army like this," said Wissam Mohammed, a 26-year-old translator and political researcher.
Though Egypt's judiciary was long respected as a bulwark of independence, and one of the only checks on ousted president Hosni Mubarak's government, analysts say the court was stacked with Mubarak sympathisers in recent years, perhaps to ease the way for what many believed was a plan to hand the reins of power to his son.
Many viewed the Supreme Constitutional Court's decision on Thursday as deeply political.
Exacerbating the perception were remarks made last week by Ahmed el-Zend, the head of the Judges Club, who declared that judges would not have overseen elections if they had known the parliament they were going to get.
"SCAF has been trying to restore elements of the old regime," Mohammed said, drawing no distinction between the court and Egypt's ruling generals.
"As much as I disagree with what the [Muslim Brotherhood] has done, this is an elected parliament and it's a bad sign that SCAF can dissolve them in the blink of an eye."
But Mohammed Rabie, a neatly dressed high school English teacher, looked at the crowd with disdain as he set his briefcase down.
"I think we are in the chaos. Let the judge say what he wants," Rabie said. "I think Shafik is a good man."
The Muslim Brotherhood, he said, had already won most of parliament's two houses and now was grasping at the presidency in a bid to take full control of Egypt and follow "the model of Iran".
Arguing Shafik would restore security, he said: "If Shafik is no good, it's only for four years and he will not be like Mubarak."
The Brotherhood now finds itself in perhaps its most perilous state since the revolution.
Though the upper house of parliament, the mostly powerless Shoura Council, remains, the lower People's Assembly is on the brink of dissolving.
The Brotherhood's success in pushing through what was known as the Political Isolation Law has also been reversed.
The law, approved by SCAF in April, banned Shafik and others who had held high-level positions in Mubarak's government from holding office for the next decade.
Shafik continued to run after the presidential election commission, filled with some of the same judges who sit on the Supreme Constitutional Court, decided to allow him in. Now the court has officially blessed that decision.
The ruling, analysts agree, is legal, since the law was poorly tailored to target only a select group of individuals.
But the way in which it was reached, with conflicts of interest and last-second timing, make the court appear to be on the side of the military and the state.
Mohammed, the housewife, said she had boycotted every election since the revolution, since she viewed the entire process as a military-organised charade.
"There will be a second revolution, there will be hundreds of deaths again," she said.
When state television announced that the court had decided to allow Shafik to stay in the race while also dissolving parliament, word spread through the crowd, who were reading Twitter and receiving text messages.
Live Box 20111120475439857
Some protesters surged toward the barbed wire, and a military armoured personnel carrier and two Central Security Force armoured vans moved into position on the other side.
But the crowd thinned, leaving a few dozen shouting at the police on the other side and leading anti-military chants.
Hours later, Shafik held a triumphant press conference - complete with a national anthem beforehand - and declared that the era of "tailoring laws" had ended.
He promised a civil state and a return of stability.
"The message of this historic verdict is that the era of political score settling has ended," Shafik told cheering supporters.
"I'm not surprised," said 18-year-old Mohammed Maher, a bespectacled engineering student at Helwan University who had carried a revolutionary socialists flag to the court protest.
"But I think all the judges they don't rule from their heads, they rule from the head of the army."
Maher said everyone expected the judiciary to rule in favour of the establishment.
"The son of a rich man becomes rich and the son of a poor man stays poor," he said, smiling wearily.
Source: Al Jazeera and agencies