The nation's highest court Thursday freed former deputy prime minister Anwar Ibrahim, a Muslim leader once seen as a future prime minister until he was fired six years ago and jailed on what he said were trumped-up charges of sodomy and corruption.

The announcement by the Federal Court of the decision to overturn Anwar's sodomy conviction brought cheers from about 100 supporters gathered in front of the domed, Islamic-style Palace of Justice. "Reformasi!" they shouted, echoing Anwar's old rallying cry.

The ruling closed one of the most divisive chapters in Malaysia's history and was seen as a bright sign for Malaysian democracy. Analysts praised the new prime minister, Abdullah Ahmad Badawi, for not interfering with the process.

The decision "is good news for Malaysian democracy," said Sidney Jones, an expert on political Islam in Southeast Asia with the International Crisis Group in Singapore. It could be a sign of a more independent judiciary, she said.

Prime Minister Mahathir Mohamad had sponsored Anwar's rise in the government, but the two men disagreed over Malaysia's policies for economic recovery after the 1997 Asian financial crisis. Mahathir fired Anwar on Sept. 2, 1998, for alleged sexual misconduct.

After his dismissal, Anwar led tens of thousands of protesters demanding democratic reform and an end to corruption in the largest demonstrations Malaysia had seen in years.

He was convicted in 2000 of sexually assaulting his wife's driver and sentenced to nine years in prison. A year earlier, he had been convicted on charges of interfering in the police investigation of the case against him and sentenced to six years. He began serving the sodomy sentence last year, upon completing the prison term for his corruption conviction, which was reduced for good behavior.

But Thursday, in a 2 to 1 ruling, the judges said the sodomy conviction was flawed. Judge Abdul Hamid Mohamad said the chief prosecution witness had been inconsistent, repeatedly changing the dates that he claimed Anwar had had sex with him.

"We are not prepared to uphold the conviction," Abdul Hamid said. "We therefore allow this appeal and set aside the conviction and sentence."

Anwar, 57, using a wheelchair and wearing a neck and back brace from an injury allegedly aggravated by a police beating, said he was grateful for his release and felt vindicated. He said that the convictions had been politically motivated but that he carried no grudge against Mahathir, who retired last year after 22 years in power. "I bear no malice against him," Anwar told reporters. "Let him retire. I feel vindicated. This is all about justice."

Mahathir, 78, expressed no remorse. "I still believe he's guilty," he told reporters in televised remarks. "As prime minister, I have every right to dismiss everybody in my cabinet. I'm not going to lose any sleep. My conscience is clear."

Anwar also thanked Abdullah for his role.

"I must take cognizance of the fact that Prime Minister Abdullah must have allowed some latitude for the judge to act professionally according to the facts and the law," Anwar said. "This is just the beginning to ensure the erosion of public confidence in the judicial system and the integrity of the judiciary is restored."

Abdullah, who took office in October, was praised for allowing the proceeding to go forward.

"For many people, the key test as to whether the reform process was working was Anwar -- if Anwar's case is heard and the appeal succeeds, that's the true test," said Karim Raslan, a political analyst, writer and lawyer. "I feel in many ways the country has passed the test."

Speaking with reporters Thursday night, Anwar's wife, Wan Azizah Ismail, said she was "pretty calm" during the proceeding because she had been told the ruling would be positive. "But I dared not believe it until it really happened. So when it happened, it was like, 'All right!' " Anwar said he hoped to fly to Munich as early as Friday for treatment for his back. Wan Azizah, now a member of Parliament, said his health was "the priority" now.

Under Malaysian law, Anwar's corruption conviction bars him from political activity for five years. However, if the high court overturns that conviction at a hearing on Monday, Anwar could return to politics immediately.

If he does come back, he will face the challenge of making himself relevant, of "updating his message," Raslan said. Anwar's party, Parti Keadilan Nasional, which was formed to press his cause while he was imprisoned, was all but obliterated in the last election. It won only one seat, held by his wife.

Mahathir brought Anwar into the government party, the United Malays National Organization, specifically because of his Islamic credentials, and together the two men helped bring about the Islamization of Malaysian politics in the years after the 1979 Iranian revolution, Raslan said.

Special correspondent Azhar Sukri in Kuala Lumpur and researcher Robert E. Thomason in Washington contributed to this report.

Anwar, center, served almost six years on corruption and sodomy charges.Anwar, left, with then-Prime Minister Mahathir Mohamad in June 1998, was fired by Mahathir three months later over what Anwar called false allegations.Anwar Ibrahim hugs his wife, lawmaker Wan Azizah Ismail, after his release from prison.