ISLAMABAD, Pakistan (CNN) -- Pakistan's Supreme Court reinstated Chief Justice Iftikhar Mohammed Chaudhry on Friday, dealing a political blow to President Gen. Pervez Musharraf.
Cheering crowds took to the streets in support of the judge to celebrate the court's ruling that found Musharraf's suspension of Chaudhry illegal.
Officials said the decision was a historic moment for the country and another victory for Pakistan's independent judiciary.
Munir Malik of Pakistan's Supreme Court Bar Association hailed the "landmark judgment," saying the decision slammed Musharraf's grip on power that has long put him at odds with pro-democracy advocates.
"I hope an independent judiciary will be a step toward the restoration of civilian supremacy in this country," Malik said.
CNN's Senior International Correspondent Nic Robertson said the court's decision was a political blow to Musharraf and a message to tell him that "he got it wrong." Earlier, Musharraf said he intended to respect the court's decision in the case.
Tariq Azim Khan, Pakistan's information minister, said the government accepted the decision and that the court's ruling "establishes once again" that the country's judiciary is free.
"That has been established once again," Khan said, adding that the ruling further "strengthened the judiciary."
Khan also said complaints received about the judge had prompted government action, saying the government had a duty to investigate the allegations. Khan would not comment on whether or not Musharraf committed a political blunder by suspending the judge.
The dismissal of the country's top judge sparked widespread demonstrations by attorneys as well as Musharraf opponents who said the move was an abuse of power.
The president's critics accused him of trying to get rid of the judge to avoid any constitutional challenges to his plan to seek a new five-year presidential term in upcoming elections. The fight also became a central issue for pro-democracy activists in Pakistan who have been at odds with Musharraf's government.
But the Pakistani leader said his decision to suspend Chaudhry was due to allegations of misconduct and that his opponents politicized a purely legal matter.
Musharraf appointed Chaudhry to the court in 2005, but the judge fell from favor after he started exercising independence from the government in a number of cases, most notably involving the disappearance of human-rights activists and terrorism suspects as part of the country's war on terror.
Musharraf removed Chaudhry from his position on March 9, accusing the judge of misusing his powers, sparking a bitter months-long battle. Government officials detained the judge at his home, his phone lines were cut and he was "physically manhandled," Malik said, adding that the treatment was "malicious."
In a government statement filed in the Supreme Court last month, Chaudhry was accused of harassing judges, a Reuters report said. The statement accused Chaudhry of showing bias in appointments and intimidating police and civil servants. Other charges included using influence to get his son a job as well as fiddling with car petrol expenses, according to the report.
Largely peaceful demonstrations over his dismissal turned violent when government supporters and Chaudhry supporters clashed in the southern port city of Karachi killing 49 people.
Musharraf has faced months of angry opposition over his decision to sack Chaudhry at the same time as leading a fresh campaign against Taliban-linked militants in northwestern Pakistan, a hideout for al Qaeda.
Musharraf, a key U.S. ally in the war on terrorism, seized power and declared himself president in a bloodless coup in 1999 after former Prime Minister Nawaz Sharif tried to dismiss him as head of Pakistan's armed forces.
In 2001, Musharraf appointed himself president while remaining head of the army. The next year, a referendum was passed granting Musharraf power for another five years. Musharraf also implemented 29 amendments to the constitution, granting himself power to dissolve the parliament and remove the prime minister.
In January 2004, Musharraf won a vote of confidence in parliament after promising to resign as head of the army at the end of the year. But in December, he announced in a televised address that he would not give up military power, saying he needs to watch over anti-terrorist operations.
Critics have condemned him for maintaining both roles. E-mail to a friend
Reuters contributed to this report.