DAKAR, Senegal (AP) — Senegal opposition leader Ousmane Sonko was convicted Thursday of corrupting youth but acquitted on charges of raping a woman who worked at a massage parlor and making death threats against her.

The court sentenced Sonko to two years in prison. He did not attend his trial in the capital, Dakar, and was judged in absentia. His lawyer said a warrant had not been issued yet for the politician's arrest.

“With this verdict, the authorities want to prevent him from standing in the next presidential election,” lawyer Cire Cledor Ly said.

Sonko placed third in Senegal's 2019 presidential election and is popular with the country’s youth. His supporters maintain his legal troubles are part of a government effort to derail his candidacy in the 2024 presidential election.

Sonko is considered President Macky Sall’s main competition and has urged Sall to state publicly that he will not seek a third term in office.

Corrupting young people, which includes using one's position of power to have sex with people under age 21, is a criminal offense in Senegal that is punishable by up to five years in prison and a fine of up to more than $6,000.

Under Senegalese law, his conviction would bar Sonko from running in next year’s election, said Bamba Cisse, another defense lawyer.

“The conviction for corruption of youth hinders his eligibility because he was sentenced in absentia, so we can’t appeal,” Cisse said. Law professors in Senegal say the verdict can be appealed but only once Sonko is imprisoned.

Tensions were rising across the country before Sonko’s conviction and sentencing. Tight security surrounded the court as well as Sonko's house on Thursday, and many businesses closed for fear of violence.

Shortly after the verdict was announced, clashes erupted at the main university in the capital. Protesters threw rocks at police officers, who fired back with tear gas. At least one car was burned.

“The verdict cements the criticism that Sall’s government is weaponizing the judiciary to eliminate prominent rivals that could shake his rule,” Mucahid Durmaz, senior analyst at global risk intelligence company Verisk Maplecroft, said.

“Despite being presented as a beacon (of) democracy, the Sonko cases demonstrate the structural issues Senegal grapples with. The court decision and the prospect of Sall’s bid for a third term in the election next year will fuel fierce criticism around erosion of judicial independence and democratic backsliding,” Dumaz said.

Earlier demonstrations turned violent in the leadup to the trial. At least one person was killed and several injured during a “freedom caravan” orchestrated by Sonko last week from his hometown of Ziguinchor, where he is the mayor, to the capital some 750 kilometers (465 miles) away.

Copyright 2023 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.