ISTANBUL -- A Turkish court on Monday sentenced comedian Deniz Goktas to more than 19 months imprisonment on charges of insulting religious values and President Recep Tayyip Erdogan. Goktas, 32, was released pending an appeal.

Goktas had been held in prison since July 3 after clips of his routine, which included a reference to Erdogan as a "dictator," were circulated online. He was convicted of insulting the president and religious values, receiving a combined sentence of 19 months and 10 days.

During his defense in the Istanbul courtroom, Goktas stated that he stood by his joke, which described Erdogan as having evolved from a "shy dictator" to one "confident in his identity." He argued that political humor had been tolerated in the past and that laws regarding insult had not changed, suggesting instead that "fragile leaders who can’t handle jokes or criticism" have emerged.

Goktas also pointed out that his remarks had not prompted any complaints until they were taken out of context and shared on social media. His show, "Dead Sea," was recorded in Istanbul in June and garnered over 9.5 million views after being uploaded to YouTube. The court was informed that 185 complaints had been submitted through a reporting system managed by Erdogan's office.

Following his arrest after returning to Turkey from vacation, Goktas was held in Karatepe high-security prison in Tekirdag province, west of Istanbul.

Erdogan has solidified his power over more than two decades in office. Critics contend that he has progressively limited freedom of expression, leading to frequent investigations, detentions, or prosecutions of journalists and government critics.

In a related legal development, Istanbul Mayor Ekrem Imamoglu, considered Erdogan’s main political rival, has been imprisoned since March of last year and is currently on trial for corruption charges. Additionally, hundreds of mayors and other officials from the main opposition party are facing prosecution over corruption allegations, while the party’s leader was removed from his position by a court order. Opponents argue these actions are intended to neutralize the opposition party in anticipation of upcoming elections.

The Turkish government maintains that its courts are impartial and operate independently of political influence.