The former Deputy Prime Minister of Malaysia has been cleared today of the sodomy charges he was standing trial for in Kuala Lumpur after key DNA evidence was questioned.

Anwar, 64, the current leader of the political opposition said he was a “little surprised” by the judge’s decision.

He had been arrested in 2008, shortly after his return to politics following a corruption charge, when an aide accused him of a sexual assault.

Anwar, who is married with six children, was arrested and charged under consensual sodomy laws, which have their origins in British colonial legislation.

But DNA belonging to Anwar which the prosecution allege was found on and in Saiful Bukhari Azlan’s body was deemed inadmissible by the trial judge.

Judge Mohamad Zabidin Diah said: “The court at this stage could not with 100% certainty exclude the possibility that the [DNA] sample is not compromised. Therefore it is not safe to rely on the sample.”

Anwar said: “Thank God justice has prevailed. I have been vindicated. To be honest I am a little surprised.”

Last week, Anwar had described the laws as “archaic” and “unjust”.

In December, Human Rights Watch called for the law to be repealed, claiming the state was trying to “slander” Anwar with the anti-gay laws.

Phil Robertson, deputy Asia director at Human Rights Watch, said: “The Malaysian government uses its outdated sodomy law to slander political opponents and critics.

“Whether or not Anwar Ibrahim engaged in consensual ‘sodomy’ is irrelevant. It’s time to reject this law and end the farcical political theater that promotes discrimination based on sexual orientation and destroys people’s lives.”

In response to the decision today, the government said: “Malaysia has an independent judiciary and this verdict proves that the government does not hold sway over judges’ decisions. The current wave of bold democratic reforms introduced by [Prime Minister Najib Razak] will help extend this transparency to all areas of Malaysian life.”

The ProGay Philippines group said it was a “legal victory”, and a positive step for LGBT rights in Malaysia, renewing calls for the scrapping of the British sodomy law in all Southeast Asian countries.

Oscar Atadero, the group’s human rights officer, said: “We join the democratic people’s movements in celebrating Anwar’s triumph over the frameup.”

An appeal may yet be lodged by the prosecution. Anwar’s accuser wrote on his blog today that he “respected the decision”, but hoped such an appeal will be pursued.