Updated

A Pakistani Supreme Court stacked with judges loyal to President Gen. Pervez Musharraf cleared the way for him to rule as a civilian president, ruling Thursday against a final challenge blocking ratification of his re-election last month.

Stepping down as army chief could help Musharraf blunt harsh criticism from opposition parties and foreign governments of his imposition of a state of emergency on Nov. 3.

However, the party of former cricket star Imran Khan on Thursday became the first to decide to boycott elections that the West hopes will produce a moderate government able to turn a tide of Islamic militancy.

The court decision — widely expected after Musharraf purged it of independent-minded judges — means the Election Commission can put a stamp of approval on the October vote that won Musharraf another five-year term.

The general has said that once he got a favorable court decision, he would quickly hang up his uniform and take the oath as a civilian. Attorney General Malik Mohammed Qayyum has said such a move could come as early as Saturday.

Thursday's ruling "means there is no challenge to his eligibility (to serve as president) and to the election," Qayyum told reporters. He said the court would issue a directive to election authorities on Friday ordering them to ratify the result.

After that, he said "the president will be free to take the oath" as a civilian president.

Musharraf declared the emergency just before the court was due to rule on complaints that the constitution barred the army chief from running for elected office.

The crackdown has seen independent TV news taken off the air and thousands of lawyers and opposition and human rights activists taken into custody. Journalists have been beaten for protesting against the media curbs.

The U.S. has stood by Musharraf, a stalwart key ally in its war on terrorism, but is the loudest voice in an international chorus calling for him to lift the emergency before the elections.

The Commonwealth, a 53-nation group composed mainly of Britain and its former colonies, is to decide later Thursday at a ministerial meeting in Africa whether to suspend Pakistan's membership.

British Prime Minister Gordon Brown said Musharraf promised in a phone call Wednesday to "do his utmost" to lift the emergency in time to allow free and fair elections and to quit the army as soon as possible.

"We have cooperated closely with Pakistan on economic and political reform, counter-radicalization and vital regional issues, but President Musharraf has no doubt about the strength of feeling in the international community" over his decision to restrict civil liberties by declaring a state of emergency, Brown said.

Washington, London and other capitals with troops in neighboring Afghanistan have been hoping for a rapprochement between Musharraf and former Prime Minister Benazir Bhutto, who has echoed his calls for moderates to unite against militancy and extremism linked to the Taliban and al-Qaida.

Pakistan's opposition parties regard the retooled court with contempt, but appear split on whether to boycott the Jan. 8 parliamentary election — a critical test for whether Musharraf can weather the political storm around him.

Bhutto's party said that as well as lifting the emergency and doffing his uniform, Musharraf would have to reconstitute the Election Commission and suspend district mayors to ensure a fair ballot.

However, it said the opposition could take weeks to reach an agreement on a boycott and Bhutto said its candidates would file nomination papers "under protest" in the meantime.

"We don't want to give a walkover to the opposition," she told reporters in Karachi.

A leading religious party is also reluctant to leave the field open to rivals

Khan took a harder line, saying his party decided at a meeting Thursday to boycott the election and would try to persuade others to follow suit.

He blasted the Supreme Court's decision as a cynical power play.

"These judges are his pocket judges. Even if he wants to have himself declared as the king, these judges will declare him the king," Khan told journalists in Islamabad. "The real judges are under house arrest."

Khan ended a hunger strike begun in jail, from where he was freed on Wednesday. The former sportsman looked gaunt and was seen munching a sweet after a news conference.

The government says it is releasing all of the thousands of opposition activists rounded since Musharraf seized extraordinary power.

However, it has yet to say whether the emergency will be lifted before the polls, despite the danger that it will undermine the legitimacy of the next government and deny Pakistan badly-needed political stability.

It has also refused to let Nawaz Sharif, another former prime minister, return from exile in Saudi Arabia to compete in the elections. Sharif told AP on Wednesday that he was trying to persuade Bhutto to shun the election and Saudi authorities to ignore Musharraf and let him go home.