CAIRO - Ahmed Shafiq, Hosni Mubarak's last prime minister, got the green light to continue his bid for Egypt's presidency on Thursday when a constitutional court ruled against a law that would have thrown him out of the race.In a further setback for his Islamist opponents, the court also declared that some rules in the post-Mubarak parliamentary election that handed control to Islamists were unconstitutional.Upcoming elections continues to breed suspenseThe legal wrangling adds to the suspense around an election that is supposed to seal a transition to democracy after Mubarak was toppled in an Arab Spring uprising last year, but has laid bare deep divisions over how Egypt should be governed.The law denying political rights to Mubarak's officials had prompted a state election committee to disqualify Shafiq from the presidential race, but he was let back in on appeal, pending the court ruling.The drama is emblematic of the tortuous and messy transition overseen by a council of generals since Mubarak was ousted 16 months ago.A first-round presidential vote last month pushed more moderate candidates out of the race and the choice now facing 50 million eligible voters reflects a society torn between desire for change after six decades of military rule and anxiety over the damage wrought on Egypt by the subsequent political chaos.Unrest has simmered on the streets of Egypt's cities throughout the period of military rule, with opponents of the army calling for the removal of "feloul", or Mubarak-era remnants, from politics. The demand is far from unanimous."Shafiq is a respectable man. We want him as president because we are not ready for Egypt to return to the Dark Ages," said Shafiq supporter Sawsan Ali Abdo. "There is no such thing as 'feloul.' We are all Egyptians. No to the plot seeking to divide Egypt," read one banner in the capital.Across the street, Shafiq campaign posters were spray-painted red to obscure his face.The head of the court said the lower house would have to be dissolved.That could draw an angry response from supporters of the Muslim Brotherhood, the biggest winner from the overthrow of Mubarak, who repressed the movement for decades.A presidential run-off vote between Shafiq and the Muslim Brotherhood's Mohamed Morsy takes place on Saturday and Sunday.The rulings prompted clapping and dancing among Shafiq supporters at a Cairo event where he was due to speak.But outside the court by the Nile, protesters threw rocks at hundreds of troops and state security conscripts who were guarding the building, which was sealed off by rolls of barbed wire. Some of the security forces began unloading dozens of boxes of tear gas canisters.The court threw out a law passed by the Islamist-dominated parliament in April that denied political rights to anyone who held a senior post in government or ruling party in the last decade of Mubarak's rule.The Brotherhood said it would accept the overturning of the law. "It's a reality now, and we must deal with it as such," said spokesman Mahmoud Ghozlan.Senior Brotherhood MP Essam el-Erian declined to comment on the parliamentary election ruling until he had seen the full details.