Malaysian opposition leader Anwar Ibrahim has been acquitted of sodomy after a two-year trial.

Judge Zabidin Mohamad Diah said DNA evidence submitted by the prosecution was unreliable and discharged the case.

Mr Anwar, 64, has consistently denied the charges and called them a government bid to cripple his political ambitions and influence.

The government said the verdict showed Malaysia’s judiciary was free from government influence.

Sodomy is illegal in Muslim-majority Malaysia but, says the BBC’s Jennifer Pak in Kuala Lumpur, very few people are ever prosecuted.

‘Justice has prevailed’
Mr Anwar had been accused of having sex with a former male aide. He had faced up to 20 years in prison if found guilty.

The acquittal caught Malaysians by surprise but not because they thought Anwar Ibrahim was guilty. The trial, dubbed by the local media “Sodomy 2.0″, was seen as an extension of his earlier conviction. Many Malaysians expected more of the same.

Mr Anwar’s struggle against sodomy charges has been front and centre in Malaysian politics for nearly 14 years. But his resolve to become prime minister, first within the governing coalition and now as the opposition leader, has never been stronger.

Now a free man, analysts say the charismatic leader cannot paint himself as a martyr. Without that helping to tip the scales, some young people hope that the next election will be more issue-based rather than focused on personalities.

But the judge said that there were questions over whether DNA evidence had been contaminated.

“The court is always reluctant to convict on sexual offences without corroborative evidence. Therefore, the accused is acquitted and discharged,” the judge said.

The verdict was greeted with cheers from Mr Anwar’s supporters, wife and daughters, our correspondent says.

Mr Anwar told journalists outside the courtroom: “Thank God justice has prevailed I have been vindicated.

“To be honest, I am a little surprised.”

Information Minister Rais Yatim said that the verdict showed that judges were free to rule as they saw fit.

“Malaysia has an independent judiciary,” he said. “The current wave of bold democratic reforms introduced by Prime Minister Najib Razak will help extend this transparency to all areas of Malaysian life.”

Police said two people were injured in two small blasts caused by explosive devices in a car park outside the court as the verdict was delivered. They did not say whether it was linked to the case.

‘Toppled’

The allegations against Mr Anwar surfaced just months after elections in 2008, in which he led the opposition to unprecedented gains at the expense of the ruling party.

1993 to 1998 – Deputy Prime Minister, under Prime Minister Mahathir bin Mohamad
1999 – Jailed for abuse of power, sparking huge street protests
2000 – Found guilty of sodomy with his wife’s driver
2004 – Supreme Court overturns the sodomy conviction, freeing him from jail. He quickly emerges as the de facto opposition leader
March 2008 – ruling coalition narrowly wins general election, but with its worst results in 50 years. The opposition makes unprecedented gains
Aug 2008 – Anwar charged with sodomy for a second time, but despite this is soon voted in as an MP
Feb 2009 – Second trial for sodomy starts
Jan 2012 – Acquitted of sodomy by High Court

This verdict comes ahead of elections due in 2013 but widely expected to be called later this year.

Hundreds of police and security personnel were on the streets of Kuala Lumpur ahead of the verdict, and thousands of Mr Anwar’s supporters waited outside the court.

Mr Anwar was once Malaysia’s deputy prime minister and an ally of former leader Mahathir Mohammad.

But he fell out with Dr Mahathir and was later jailed for corruption and sodomy. The sodomy conviction was later overturned and he was freed in 2004 after spending six years in prison.

He is now seen as the key figure in Malaysia’s opposition coalition, which currently controls about a third of the seats in parliament.

The governing party has been in power for over 50 years and, says our correspondent, Mr Anwar is seen as the only person capable of challenging their dominance.

In a tweet from his account minutes after the verdict, the opposition leader looked ahead to the polls.

“In the coming election, voice of the people will be heard and this corrupt government will be toppled from its pedestals of power,” the message read.