Egypt's highest court ruled on Sunday that the nation's Islamist-dominated legislature and constitutional panel were illegally elected, dealing a serious blow to the legal basis of the Islamists' hold on power.

The ruling by the Supreme Constitutional Court says that the legislature's upper house, the only one currently sitting, would not be dissolved until the parliament's lower chamber is elected later this year or early in 2014. The constitutional panel has already dissolved after completing the charter.

The ruling deepens the political instability that has gripped the country since the overthrow of authoritarian leader Hosni Mubarak more than two years ago.

The same court ruled to dissolve parliament's lower chamber in June, a move that led to the promotion of the normally toothless upper chamber, the Shura Council, to becoming a law-making house. The Shura Council, long derided as nothing more than a talk shop, was elected by about seven percent of the electorate last year.

It was not immediately clear whether the ruling on the 100-member constitutional panel would impact in any way on the charter it drafted. The constitution was adopted in a nationwide vote in December with a relatively low turnout of about 35 percent.

But even if it does not, the ruling will question the legal foundations of the disputed charter pushed through by allies of Islamist President Mohammed Morsi in an all-night session late last year. Critics say the charter restricts freedoms and gives clerics a say in legislation. The Islamists who drafted it hail the document as the best one Egypt has ever had.

In what appeared to be an attempt to remove any confusion over the ruling, Morsi's office issued a brief statement in which it emphasized that all state institutions must respect the constitution, that the Shura Council will continue to function as the nation's legislature and that the president will ensure that all the branches of state are fully functioning.

Regardless of its consequences on the ground, Sunday's ruling is likely to prolong the polarizing political transition that followed Mubarak's overthrow. Rival political groups disagree not just on policies and the future course of the nation but on the legitimacy of the basic institutions of government.

It will give heart to the mostly secular and liberal opposition, while providing fresh ammunition to the argument often repeated by the president's supporters that the judiciary is filled with Mubarak loyalists determined to derail the nation's political process.

Morsi, elected nearly a year ago, tried to reinstate parliament's lower chamber just days after he came to office on June 30 but eventually bowed to the court ruling and backed down.

In both rulings on parliament's two chambers, the court contended that political parties that fielded candidates for the third of seats set aside for independent candidates, as allowed by the election law, amounted to a breach of the principle of fairness.

The Shura Council's critics say it is ill-equipped to be the nation's sole law-making body, and complain that it's considering legislation that will have a far reach into the future rather than simply pass what is absolutely necessary during the transition period.

Of the chamber's 270 members, 180 were elected, and Morsi appointed the other 90. Five percent of its members are Christians -- about half the proportion of the population -- and four percent are women.

When Shura Council elections were held in early 2012, not only did many voters stay away but so did many political parties -- especially several of the newborn liberal groups with smaller budgets. Over 70 percent of the seats were won by Islamists.

The court on Sunday also ruled unconstitutional clauses in a 1958 law giving the president far-reaching powers under a state of emergency. The invalidated clauses allowed suspects to be arrested with little recourse and placed restrictions on the freedoms of movement and assembly.

The ruling comes ahead of the scheduled climax on June 30 -- the president's first anniversary in office -- of a campaign by anti-government protesters to collect 15 million signatures of Egyptians who want to see Morsi leave office.

Morsi has yet to say whether he intends to take any action against the campaign or its organizers, who plan to stage a mass protest outside his Cairo palace on June 30. But the president's supporters have denounced as illegal the campaign, called Tamarod, or "Rebel," and there have been several street scuffles between the two sides.