A Malaysian court has sentenced opposition leader Anwar Ibrahim to five years in jail after overturning his acquittal on sodomy charges.
Mr Anwar led the opposition to its strongest ever performance in the May 2013 general elections.
While homosexual acts are illegal in Muslim-majority Malaysia, very few people are ever prosecuted.
Mr Anwar has always maintained the charges were part of a political smear campaign.
The court decision will affect Mr Anwar's plans to compete in a key by-election in the state of Selangor this month, reports say.
A victory for Mr Anwar would mean he could become Selangor's chief minister - widely seen as a powerful post.
The court said he could remain free on bail while he appeals against the verdict to the country's highest court, AP news agency reported.
"All over again, after 15 years, they want to put me in the lockup and that is why they are rushing," Mr Anwar said after his acquittal was overturned.
He added that Prime Minister Najib Razak's government "faces the wrath of the people".
Meanwhile, a government spokesman said: "This is a case between two individuals and is a matter for the courts, not the government."
In 2008, Mr Anwar was accused of having sex with a male aide. A High Court cleared him of the charges in 2012, citing a lack of evidence.
The government later appealed against his acquittal.
"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 group Human Rights Watch, said after the verdict.
Correspondents say Mr Anwar is seen as the key challenger to the ruling party, which has been in power since Malaysia's independence in 1957.
The Barisan Nasional coalition won 133 of the 222 seats in parliament in the 2013 elections - although it won the elections, it was the coalition's worst ever result.
Thousands of Malaysian opposition supporters rallied against the result, alleging that the polls were fraudulent.
Mr Anwar was previously a member of the Barisan Nasional coalition, but fell out with top leaders and was sacked in 1998.
He was then charged with sodomy and corruption, and given a six-year jail term for abuse of power, which sparked huge street protests.
In 2000 he was also found guilty of sodomy with his wife's driver and jailed for a further nine years.
In late 2004 Malaysia's Supreme Court overturned the sodomy conviction, freeing him from jail.
He then emerged as a leader in the opposition movement, leading it to increasingly strong performances in both the 2008 and 2013 elections.