The favourable, albeit predictable, ruling came on a day Pakistan suffered the humiliation of being suspended by the Commonwealth.
 
Special report

A committee of foreign ministers "has suspended Pakistan from councils of the Commonwealth pending restoration of democracy and rule of law in the country", Don McKinnon, the group's secretary-general, said in Kampala, Uganda.

Musharraf has decreed new amendments to the constitution using powers he said he has under the emergency.
 
One of the amendments stated that his decisions cannot be challenged by any court and will be considered "always to have been validly made".
 
Final case
 
The case before the supreme court on Thursday centred on a claim by Zahoor Mehdi, a potential rival presidential candidate, who was blocked by the election commission from competing in the vote.
 
He argued the decision was wrong, but the court said his nomination papers were not valid.

Five other cases challenging the election were either thrown out or withdrawn on Monday.

Sharifuddin Pirzada, Musharraf's chief legal adviser, said there was now no legal obstacle to his re-election.

He said: "Now the court has to give us this in writing."
 
Bitterly divided
 
Kamal Hyder, Al Jazeera's correspondent in Islamabad, said: "The opposition is not likely to take this sitting down."
 
However, he said that "the opposition has shown itself to be bitterly divided". 
 
Sharif may be back in Pakistan before the
January 8 parliamentary election [AFP]
Pakistan's supreme court is also considering challenges to the emergency rule, declared on November 2, with a decision expected later on Thursday.
 
In another development, the head of the governing party said on Thursday that Nawaz Sharif, the exiled former prime minister, has secured the agreement of Saudi Arabia to let him return to Pakistan.
 
"There is some deal" with Saudi authorities for Sharif to come back, Chaudhry Shujaat Hussain, president of the Pakistan Muslim League-Q party, said.
 
He suggested that Sharif would be back in Pakistan before the January 8 parliamentary elections.
 
"We are ready to face him and he has to face the people," Hussain said on Dawn News television.
 
Decision criticised

Across Pakistan, over the past two days, more than 5,000 people detained during the state of emergency, including Imran Khan, the opposition politician, have been freed from jail.

Speaking to Al Jazeera on Thursday on the supreme court decision, Khan said: "No one views this ruling as credible ... the whole reason for the events of November 2 was to destroy the supreme court ... and Musharraf's own pocket judges replaced them.

Your Views

 
Azee, Boston, USA
 
Send us your views
"General Musharraf will be able to rig the elections because there willl be no supreme court to protect the electoral commission ... or the media.

"The only thing left is to discredit these elections by boycotting them. George Bush is backing one man against 160 million people."

Condoleezza  Rice, the US secretary of state, said the release was a "good step" toward restoring constitutional rule, but others were still needed.

She said: "Well, I do see that a number of figures, opposition figures, have been released. But that's a good step. But it's one step of what's needed."
 
Washington has been hoping for a rapprochement between Benazir Bhutto, the former prime minister, and Musharraf, who US officials call a key ally in confronting the Taliban and al-Qaeda.
 
Bhutto, however, has talked recently of joining forces with Sharif if emergency rule is not swiftly ended.
 
But Sharif said that he had failed to convince her in a telephone conversation on Wednesday to join him in boycotting elections due in January.
 
Ugly vendetta
 
The government also claims to have freed Iftikhar Mohammed Chaudhry, the former supreme court justice, his family and five other judges purged from the court when Musharraf suspended the constitution.
 
But those judges have not been seen in public, and their supporters claim they remain under house arrest.
 
On Thursday, New York-based Human Rights Watch (HRW) criticised the continued detentions and demanded the judges be released.
 
Brad Adams, Asia director at HRW, said: "Musharraf should end his ugly vendetta against the judges and free Chaudhry, his family and the other judges immediately."

Source: Al Jazeera and agencies