EDIRNE, Turkey — A prominent Kurdish politician, Selahattin Demirtas once helped Turkey’s leader come close to ending the decades-old conflict with Kurdish militants that has killed tens of thousands of people.

Today, Mr. Demirtas is in prison, where he has been for more than 20 months on 100 charges ranging from terrorism to insulting that same leader, President Recep Tayyip Erdogan. He has been barred from the mainstream media.

Yet all of that did not stop him from running for the presidency in Turkey’s recent elections — and finishing third.

Now that Mr. Erdogan has won the June 24 election, the chances that Mr. Demirtas will be released from prison are dimming. Mr. Erdogan is amassing power in a new presidential system — allowing him to exert control in nearly every aspect of public life — and has effectively sidelined those who challenge him.