Turkey's elections are fairly free, and there is going to be one this Sunday. President Recep Tayyip Erdogan has been in power for two decades, and he should really lose by a landslide. Imagine what the United States would be like if Donald Trump had been in power for 20 years, and that's what Turkey looks like today.
The courts work for Mr Erdogan's ruling AK Party (Justice and Development Party), and it's a crime to insult the president. Tens of thousands of people are investigated for it every year, and the penalty if you're found guilty is one to four years in jail.
The jails are full of journalists and politicians, the media are no longer free, and the economy is a mess: inflation is over 100% a year, and most people are struggling to get by. Five years ago, the Turkish economy was 16th largest in the world, and forecast to be 12th biggest by 2050. Instead, it has fallen to 19th.
At least 50,000 people were killed in two severe earthquakes in southeastern Turkey last February, but tens of thousands could have been saved if the government had been quicker to rescue the people trapped under their collapsed homes. What put them there was also down to Mr Erdogan because earthquakes don't kill people; bad buildings do.
Hundreds of thousands of buildings in the stricken region collapsed because of shoddy construction that ignored the expensive anti-earthquake building codes.
Mr Erdogan's close relationship with the construction industry let corrupt developers put up whatever they liked and then make it legal by paying modest fines in periodic "building amnesties".
All this is public knowledge, and yet this election is too close to call. Six opposition parties have finally got together (the "Table of Six") and chosen a credible leader, Kemal Kılıcdaroglu.
Their project for economic recovery and the repair of Turkish democracy is plausible. So why are they still running neck and neck with Mr Erdogan's AK party?
Mr Erdogan has pulled all his usual tricks. Despite the desperate state of the economy, he has raised pensions by 30%, doubled the minimum wage, and enabled two million people to retire early.
He claims to be defending Islam and accuses the opposition of conspiring with Kurdish rebels. He has brought criminal charges against some opposition leaders. He controls most of the mass media, which sing his praises and ignore Mr Kılıcdaroglu and the Table of Six except to abuse them.
But Turks aren't fools, and they have had twenty years to learn that most of what Mr Erdogan says is lies, and most of his promises don't come true. So why is he still a serious contender for the presidency after all this time? For the same reason that Donald Trump is still a serious contender for the US presidency.
Turkish political analyst and pollster Can Selcuki put it nicely: none of Mr Erdogan's failings and failures will do him fatal harm politically because "this election is not about performance. It's about identity. Those who want him, want him no matter what". Sound familiar?
It is now a full century since the founder of the Turkish Republic, Mustafa Kemal (Ataturk), abolished the Sultanate and made the country a secular state with a constitution based on Western models.
He was a soldier who had fought all his life to keep Turkey from being taken over and carved up by European empires. He was convinced that only by modernising in the Western style could Turkey successfully compete and survive, and he was probably right.
Ataturk's vision was to turn the country into a powerful, fully developed European democracy that just happened to be Muslim, and to a large extent, that has come to pass. But it was bound to be resisted by the pious and conservative part of the population, and modern Turkish history has been a see-saw struggle between the secular and the devout elements.
Mr Erdogan's genius was to mobilise all the devout -- mostly the old, the rural, and the less well-educated -- into a broad political alliance. It currently controls none of Turkey's big cities, and it rarely gets much more than half the vote. But even a little more than half is enough to give you power in a democracy, especially if you start changing the rules in your favour.
This time might be different: the polling for the presidential election shows Mr Kılıcdaroglu just ahead of Mr Erdogan. But it's within the margin of error, and the parallel race for seats in parliament is even harder to call.
Five more years of Mr Erdogan would not be good for Turkey's economy, but it would not be a catastrophe. The demographic trend in Turkey strongly favours the secular modernisers, and they'll get there in the end.