- "I will never surrender," Anwar tells CNN after court rejects his appeal
- "Grim day for human rights and democracy in Malaysia," tweets rights activist
- The government denies the case was political, saying the judiciary is independent
The decision appeared likely to be the final chapter in a lengthy and politically contentious legal battle, taking Anwar out of contention for elections for the foreseeable future.
Anwar, 67, was acquitted of the sodomy charge in January 2012. But after the government appealed, a higher court overturned the decision in March 2014, sentencing him to five years in prison.
The Federal Court, the country's highest, on Tuesday rejected Anwar's appeal of the conviction and upheld the sentence, according to Bernama, the national news agency.
The head of an alliance of opposition parties, Anwar has repeatedly said he is innocent, calling the case against him an effort concocted by the Malaysian government to end his political career. The government denies that accusation.
After the court decision Tuesday, Anwar said he "will not be silenced," vowing to continue to "fight for freedom and justice."
"I will never surrender," Anwar told CNN by phone, although he conceded that his task will be made a lot harder by the confines of a prison cell.
'Grim day for human rights'
Human rights groups have criticized the case against Anwar, calling it politically motivated.
"Grim day for human rights and democracy in Malaysia," tweeted Phil Robertson, deputy director of Human Rights Watch's Asia division.
Anwar's trial "was blatantly political from day one," Robertson wrote after the verdict was announced.
The Malaysian government said Tuesday that the Federal Court judges "will have reached their verdict only after considering all the evidence in a balanced and objective manner."
Sodomy, even if consensual, is an offense punishable by up to 20 years in prison in Malaysia.
"Malaysia has an independent judiciary, and there have been many rulings against senior government figures," the government statement said.
Previous legal battles
Anwar was the heir apparent to former Prime Minister Mahathir Mohamad until 1998, when he was sacked and charged with corruption and sodomy.
He spent six years in prison after being convicted of corruption charges in 1999 and of sodomy charges involving his wife's former driver in 2000.
Malaysia's highest court overturned the sodomy conviction and ordered him released from prison in 2004. However, the corruption verdict was never lifted, barring him from running for political posts until 2008.
Investigators arrested Anwar again in July 2008 over allegations that he sodomized his former aide, Saiful Bukhari Azlan.
The arrest came four months after a loose coalition of opposition parties that Anwar led won 82 of 222 parliamentary seats in elections. It was only the second time in the country's history that the governing coalition had failed to gain the two-thirds majority needed to amend the constitution.
The governing coalition, which has been in power for more than half a century, fell short of that mark again in elections in 2013 but retained its grip on power.