Malaysia's highest court found opposition leader Anwar Ibrahim guilty on charges of sodomy on Tuesday in a case that his supporters say was politically motivated, and will likely end a career marked by controversy.
The Federal Court's judgement upholds a ruling by the Court of Appeal in March last year, which found the 67-year-old guilty of sodomizing a former political aide.
He has been sentenced to five years in prison.
Hundreds of Anwar supporters, surrounded by dozens of police, gathered outside the court in Kuala Lumpur waving party flags and shouting "Down with Barisan Nasional".
The ruling may spark protests after opposition gains in a 2013 general election raised the possibility of a genuine challenge for the Barisan Nasional coalition that has ruled since 1957.
The conviction disqualifies Anwar from political office and contesting the next election that must be held by 2018.
Human Rights Watch decried what it called Anwar's "selective persecution".
Prime Minister Najib Razak's government has rejected any suggestion of interference in the case.
"Malaysia has an independent judiciary, and there have been many rulings against senior government figures," a government statement, issued after the ruling, said.
"The police report against Anwar Ibrahim was brought by a private individual - Anwar's employee and personal assistant - not by the government."
Anwar was accompanied by his wife and children in the courtroom.
In the mid-1990s, Anwar was the ruling UMNO party's rising star before he fell out with then premier Mahathir Mohamad.
He was sacked in 1998 and then campaigned against corruption and nepotism and led a nationwide "reformasi" (reform) protest movement.
Since then, the former deputy prime minister has been beset by legal problems and spent several years in prison after being convicted of corruption and an earlier sodomy charge.
But the charismatic Anwar, who heads a three-party opposition alliance, has remained the greatest threat to Malaysia's political establishment.
His lawyers appealed against a conviction last March of sodomizing a male political aide, and a sentence of five years in prison. Sodomy is illegal in Muslim-majority Malaysia.
Anwar denied the charge and said it was politically motivated.
Some ruling party members and analysts have played down fear of upheaval if the ruling goes against Anwar.
"Anwar's political image is not anywhere near close to what it was in the '90s," said Wan Saiful Wan Jan, of the Institute for Democracy and Economic Affairs. "The country has moved on."
Anwar's jailing could herald the disintegration of the three-party alliance he leads. It is paralyzedwith infighting and a meeting on Sunday to iron out differences and find a possible successor to Anwar was inconclusive.