Kuala Lumpur, Malaysia (CNN) -- A Malaysian court on Monday found the opposition leader Anwar Ibrahim not guilty of sodomizing a former male political aide, bringing a conclusion to a politically charged trial that has lasted more than two years.
The court room erupted in cheers from Anwar's supporters after the verdict and some of his family members burst into tears.
"Justice has been done," Anwar said as he left the court building, walking into a crowd of camera-wielding journalists and supporters. "I feel I have been vindicated."
Hundreds of his supporters had gathered outside the court building Monday ahead of the announcement of the verdict. They had begun arriving in a nearby parking lot before sunrise, accompanied by a heavy police presence.
Anwar had been on trial in the Kuala Lumpur High Court on allegations that he sodomized the former aide, Saiful Bukhari Azlan, in June 2008. Sodomy, even if consensual, is an offense punishable by up to 20 years of prison in Malaysia.
In delivering the decision, the judge said it was not safe to rely on DNA evidence that had been cited in the trial, since it could have been contaminated. The court was not willing to give a guilty verdict based on uncorroborated evidence, the judge said.
Anwar had repeatedly insisted he was innocent, saying that the trial was an attempt by the government to end his political career -- an assertion the government has consistently denied.
Investigators arrested Anwar in July 2008 -- four months after a loose coalition of opposition parties he led made gains on the ruling party in parliamentary elections.
This was the second time Anwar, 63, had been tried for sodomy. In 1998, Anwar, a former deputy prime minister, was convicted of sodomy and jailed for six years before a court overturned his conviction in 2004.