Pakistan's highest court dealt President Pervez Musharraf the biggest political blow of his eight years in power, blocking the U.S.-allied general Friday from removing the country's chief justice.

The surprise decision to throw out Musharraf's case against the jurist spurred new demands from democracy campaigners that the president step down, clouding his future just as Pakistan faces a surge in violence by Islamic militants.

Recent fighting had overshadowed the judicial dispute, and the ruling likely will ease public anger over the ouster, at least for now. Musharraf said he would respect the decision, but analysts said Pakistan could be in for turbulent times if he sticks with his drive to stay in power.

In its landmark ruling, Supreme Court judges ruled unanimously that Chief Justice Iftikhar Mohammed Chaudhry be restored to his post and voted 10-3 to quash charges of misconduct that the president filed against the justice before a separate judicial tribunal.

The reach of the rulings was a surprise. Many Pakistanis had expected the court to reinstate Chaudhry but let the tribunal's investigation continue, and the verdict was widely hailed as a democratic breakthrough for a country dominated by the military for most of its 60-year history.

It was seen as strengthening the independence of the courts, which are expected to hear challenges to Musharraf's plan to seek a new five-year presidential term from outgoing lawmakers rather than wait for parliamentary elections due by January.

Critics also oppose Musharraf holding the dual posts of president and chief of the military, as he has since seizing power in a 1999 coup.

Cheers from lawyers who have led mass protests against Musharraf reverberated around the high-roofed Supreme Court chamber after a grim-faced presiding Judge Khalil-ur-Rehman Ramday announced that Chaudhry's suspension was "illegal" and set aside the charges against him.

In accepting the verdict, Musharraf gave no indication of his next move.

"The president respects the decision of the Supreme Court," his spokesman, Rashid Qureshi, was quoted as telling the state-run news agency. "The president has stated earlier that any judgment the Supreme Court arrives at will be honored, respected and adhered to."

A similar tone was struck by the U.S. government, which considers Musharraf a key ally in the fight against terror groups.

State Department deputy spokesman Tom Casey said the reinstatement "respects the rule of law" and he praised the fact that the high court is "capable of making independent decisions."

Musharraf's defeat prompted jubilation at gatherings of lawyers in major cities, including Karachi, Multan, Faisalabad, Quetta, Peshawar and Rawalpindi.

Outside the court in Islamabad, Chaudhry's lead attorney, Aitzaz Ahsan, said the chief justice's reinstatement was "a victory for the entire nation."

Lawyers swarmed the lawyer, chanting "Go, Musharraf, go!"

Former Prime Minister Benazir Bhutto, who lives in exile, called the ruling one of the most remarkable judgments in Pakistan's history and said it weakened Musharraf politically. She said the movement to support Chaudhry had become a "struggle against dictatorship, (for the) restoration of the Constitution and for supremacy of the Parliament."

There has been speculation Bhutto was considering joining her Pakistan People's Party with Musharraf in a new coalition government, but political analysts said the ruling could scuttle that idea.

"I have real doubts whether Benazir Bhutto would jump onto a sinking ship," said Rasul Bakhsh Rais, a political science professor at Lahore University of Management Sciences. "But even if that happens, it will be temporary relief because any measure by the president will be challenged in the Supreme Court."

He predicted judges emboldened by Friday's decision would torpedo Musharraf's plan to continue as military chief and get a new presidential mandate from the outgoing parliament and also block any attempt by the president to impose a state of emergency or martial law.

Musharraf has been embattled since he suspended Chaudhry on March 9, accusing the judge of using his rank to secure a police job for his son and enjoying unwarranted privileges such as the use of government aircraft.

While the government insisted the case had no political motive, critics suspected Musharraf wanted to remove an independent-minded judge before the legal challenges are made against his effort to retain power.

Hafiz Hussain Ahmed, a leader of a six-party coalition of Islamist opposition parties opposed to Musharraf's alliance with Washington, urged the president to "accept his mistake and quit."

The government's mishandling of Chaudhry — he was confronted by the heads of Pakistan's feared intelligence agencies when he refused to resign and spent days under virtual house arrest — eroded Musharraf's support among many voters and even his political allies.

He was particularly hurt after he stood by a pro-government party accused of orchestrating clashes with Chaudhry supporters in Karachi in May that killed more than 40 people.

In a reflection of the unease among Musharraf's supporters, a leader of the ruling Pakistan Muslim League-Quaid party, Mushahid Hussain Sayed, welcomed Friday's ruling as "historic" and congratulated Chaudhry even though the judge has become a rallying point for government foes.

With violence escalating between the government and religious militants, democracy campaigners argue that the United States shouldn't view the Pakistani military as the sole guarantor of the country's stability.

"On the one hand, they want to build democracy and a democratic future in Muslim society," Rais said of U.S. officials. "At the same time, in every country where democracy has a real possibility, they have been hedging their bets."

Suicide attacks, bombings and fighting between security forces and Islamic militants has killed about 290 people since clashes between the army and radicals in Islamabad's Red Mosque broke out July 3.

"We must all unite against the current wave of extremism and militancy," Prime Minister Shaukat Aziz was quoted by state media Friday as he announced his acceptance of the Supreme Court's verdict.

There was no let-up in the violence — a suicide attack in the restive North Waziristan region killed four people Friday.