Around the world, Turks are flying home to vote in Sunday’s presidential and parliamentary election. That might seem like a pointless exercise since President Recep Tayyip Erdogan, who came to power in 2003, long ago abandoned efforts to build a model Muslim democracy in favor of a personality-driven authoritarian government with an increasingly conservative religious cast.

But because the election will shift even more power to the president, there has been a surge in voting interest. While Mr. Erdogan has the upper hand, he faces his most serious competition ever and is, experts say, running scared. That is a good sign for Turkish democracy, no matter who wins.

The weakness and danger of Mr. Erdogan’s continued rule has become more apparent, as an economic and development boom that won him broad support has waned. He has fostered corruption, eroded the rule of law and alienated the United States and other NATO allies while inching closer to Russia and Iran. There is little foreign investment coming in, and Turkish capital is flowing out, seeking better returns in more stable political environments elsewhere.

The fact that the election, originally set for 2019, was brought forward 18 months hints at Mr. Erdogan’s sense of vulnerability and determination to stay in power. He has been shaken by his Justice and Development Party’s loss of a parliamentary election in 2015, by an abortive coup in 2016 and by allegations of corruption against himself and his family.