ISTANBUL: A Turkish court on Wednesday sentenced Istanbul Mayor Ekrem Imamoglu, a popular rival of President Tayyip Erdogan, to more than two years in prison and imposed a political ban for insulting public officials, in a ruling set to go to an appeal.

The ruling comes just six months ahead of scheduled presidential and parliamentary elections, in which Imamoglu has been mooted as a potential strong challenger to Erdogan. A main opposition presidential candidate has not yet been chosen.

Imamoglu, from the opposition Republican People’s Party (CHP), was tried over a speech after 2019 local elections in Istanbul when he said those who annulled the vote were “fools.” The charge carried a maximum prison sentence of four years.

Imamoglu narrowly won the municipal election in March 2019, beating a candidate from Erdogan’s ruling AK Party. After those results were annulled, he won the re-run vote comfortably. His victory ended the 25-year rule in Turkiye’s largest city by the AKP and its Islamist predecessors.

The outcome of the 2023 election is seen hinging on the ability of the CHP and others in opposition to join forces around a single candidate to challenge Erdogan and the AKP, which has governed Turkiye for two decades.

A jail sentence or political ban would need to be upheld in appeals courts, potentially extending the case beyond the election due by June 2023. Critics say Turkish courts bend to Erdogan’s will. The government says the judiciary is independent.