(Adds U.S. State Department comment, paragraphs 20-21)
By Al-Zaquan Amer Hamzah
PUTRAJAYA, Malaysia, March 7 (Reuters) - A Malaysian court convicted opposition leader Anwar Ibrahim of sodomy and sentenced him to five years in prison on Friday, shattering his plan to take control of the country's richest state and stoking political tension in the Southeast Asian nation following a divisive national election last year.
Three judges at the Court of Appeal unanimously voted to overturn Anwar's acquittal two years ago in a rapid ruling that his supporters and international human rights groups say was politically influenced and aimed at ending his career.
The former deputy prime minister, who was previously jailed for six years on sodomy and corruption charges, will not be jailed immediately as his lawyers won a stay of the sentence pending an appeal.
But the ruling bars Anwar from running for a seat in the state assembly of Selangor this month, a move that would likely have paved the way for him to become chief minister of Malaysia's most populous state - a potent platform from which to attack the government ahead of the next national election.
If Anwar, 66, loses his federal court appeal, he would face jail and would be barred from contesting the next national election that must be held by 2018.
"It's (happening) all over again after 15 years," Anwar, who was sacked as deputy prime minister and finance minister in 1998 and convicted a year later, told reporters.
"This is a travesty of justice. This has been choreographed," he added, saying the government had underestimated "the wrath of the people."
A government spokesman said that Malaysia had an "independent judiciary."
"This is a case between two individuals and is a matter for the courts, not the government," the spokesman said.
Before his fall from grace, Anwar was Malaysia's political star, heir-apparent to then prime minister Mahathir Mohamad as leader of the long-ruling United Malays National Organisation (UMNO).
His sacking, following the 1997 Asian financial crisis, came after he campaigned against corruption and nepotism in politics and led a nationwide "reformasi" (reform) movement.
His sodomy conviction was overturned in 2004 and he returned to politics as the head of a revitalised opposition whose strong showing in 2008 elections deprived the ruling National Front of its traditional two-thirds majority in parliament.
The charismatic Anwar remains a potent threat to the coalition led by Prime Minister Najib Razak, whose majority was cut further in an election last May that deepened racial divisions in the multi-ethnic country and which the opposition claimed was tainted by cheating. The opposition won the popular vote for the first time on its promises of greater transparency and change after 56 years of UMNO-dominated rule.
"A DARK DAY" FOR JUDICIARY
The result has empowered ethnic Malay nationalists within UMNO, forcing Najib to row back on his liberal reform agenda and stoking racial and religious tensions.
Ooi Kee Beng, deputy director of Singapore's Institute of Southeast Asian Studies, said ruling party leaders had likely been shaken by the prospect of Anwar at the helm of Selangor.
As chief minister of the state, Anwar "would be able to play a real Malay leader and not just a politician who just promises things and is a wonderful demagogue", Ooi said.
But he said the government could face a backlash from voters over the ruling, as opposition supporters are galvanised by what they see as blatant political manoeuvring by the government.
Human Rights Watch had called the case "politically motivated persecution" and said the government wanted to remove Anwar from the political scene "by hook or by crook".
"It's truly a dark day for the Malaysia judiciary, which has shown itself incapable of standing up straight when national political issues are in play in cases before them," Phil Robertson, deputy Asia head of Human Rights Watch, said after the verdict.
The United States is closely following the case, State Department spokeswoman Jen Psaki said.
"In this high-profile case, it is critical for Malaysia to apply the rule of law fairly, transparently, and apolitically in order to promote confidence in Malaysia's democracy and judiciary," she said in a statement.
About 40 Anwar supporters shouted "Reform" and "Free Anwar" outside the court in the administrative capital Putrajaya where riot police were stationed in full gear. Malaysia's chief of police warned of stern action against anyone planning to protest against the verdict.
Anwar's defence has been dealt a series of setbacks in recent weeks. It failed in three attempts to disqualify the lead prosecutor, Shafee Abdullah, arguing that the lawyer's strong links to UMNO would hurt the chances of a fair trial.
Much of the case's arguments over the two-day trial revolved around the integrity of DNA samples that the prosecution said proved Anwar had sodomised his aide at an apartment in the capital Kuala Lumpur. The defence had argued that the court could not find Anwar guilty due to substantial evidence that the semen samples had been degraded or tampered with.
One of the judges said that the judge in the case two years ago had "misdirected" himself on the integrity of the samples.
"Such failure merits an intervention," said justice Balia Yusof Wahi. (Additional reporting by Niluksi Koswanage, Doina Chiacu in Washington; Writing by Stuart Grudgings; Editing by Nick Macfie and Ken Wills)