Malaysia's top court on Tuesday upheld opposition leader Anwar Ibrahim's sodomy conviction in a case seen at home and aboard as politically motivated to eliminate any threats to the government.

Federal Court judge Arifin Zakat, who read the verdict on behalf of the five-judge panel, said the accusation by an Anwar aide that he was sodomized was credible, and that it was upholding a 5-year sentence imposed by the Appeals Court last year.

This was Anwar's last avenue for appeal, and it means he will go back to prison immediately.

Arifin said the defense allegations that the case was a political conspiracy "remains an allegation, unsubstantiated by any facts whatsoever."

Anwar was accused of sodomizing a male aide in 2008, but was acquitted by the High Court in 2012. However, the Appeals Court overturned the acquittal in March last year and sentenced him to five years in jail. He has said the charges were trumped up to kill his political career.

Anwar was seen as the most potent threat to Prime Minister Najib Razak's ruling party.