KUALA LUMPUR (Reuters) - Jailed Malaysian opposition leader Anwar Ibrahim on Wednesday lost his final bid for freedom when a federal court rejected his appeal to set aside his sodomy conviction and five-year jail term.

Once a rising star in the ruling United Malays National Organisation (UMNO) party, Anwar is the greatest threat to Prime Minister Najib Razak and his coalition, after leading a three-party opposition alliance to stunning electoral gains in 2013.

A panel of five judges ruled unanimously that Anwar’s application for a review of his 2014 conviction, his final legal option for an acquittal, was without merit.

“This is not a fit or proper case for this court to exercise its inherent jurisdiction to initiate a review,” Zulkefli Ahmad Makinudin, the Chief Judge of Malaya, said as he read excerpts from a 60-page ruling.

Anwar was convicted and jailed for sodomizing a former aide, a charge he and his supporters describe as a politically motivated attempt to end his career.

“This is not the end of the road ... I have pleaded and reiterated my innocence, but the judiciary has ignored my pleas,” Anwar told reporters in the court after the verdict.

“This is a long walk to freedom,” he said.

Anwar is widely expected to be released after serving another 16 months, as Malaysia grants a one-third reduction of jail terms for good behavior. Anwar’s prison term ends in 2020.

But the conviction disqualifies him from political office and from contesting the next election that must be held by 2018.

Malaysia's opposition leader Anwar Ibrahim speaks to the media ahead of the verdict in his final appeal against a conviction for sodomy in Kuala Lumpur February 4, 2015. Malaysia's Federal Court will give its verdict on Anwar's sodomy conviction appeal on February 10. REUTERS/Olivia Harris

Najib has been buffeted by graft allegations and faced the biggest challenge to his leadership last year following reports that hundreds of millions of dollars had been misappropriated from state fund 1Malaysia Development Berhad (1MDB).

However, the prime minister weathered the political crisis by consolidating power and cracking down on dissent.

TRAGEDY FOR JUSTICE

Crowds of demonstrators gathered outside the court ahead of the verdict, to show support for the 69-year-old Anwar, backed up by the presence of his wife, children and grandchildren in the courtroom.

The verdict was a “real tragedy for justice,” said Phil Robertson, deputy Asia director of New York-based rights group Human Rights Watch.

“With this final decision running roughshod over Anwar’s rights and sending him back to prison, Najib and the ruling UMNO party have just fired the starting gun on the expected 2018 election by permanently sidelining the opposition’s most capable leader,” Robertson added.

A former deputy prime minister of the ruling party, Anwar’s legal troubles began soon after he fell out with then prime minister Mahathir Mohamad in the late 1990s and was sacked.

He then campaigned against corruption and nepotism and led a nationwide “reformasi”, or reform, protest movement. He was later jailed for the first time on charges of sodomy and graft.

In a 2013 election, Anwar led an opposition alliance that posed the first genuine challenge to UMNO, which has ruled Malaysia since independence in 1957.

But the opposition fell apart after Anwar’s imprisonment, and the ruling coalition took advantage to coast to victory in several by-elections this year.