For a time, it looked as if Turkey’s battered democracy might pull off an improbable revival in Sunday’s national elections. With the Turkish economy reeling, the aura of inevitable victory that surrounded President Recep Tayyip Erdoğan, who has led his country without pause for fifteen years, appeared to be dissipating. His chief opponent, Muharrem İnce, of the Republican People’s Party, ran a strong campaign, at times calling out the corruption that surrounds Erdoğan and his circle. İnce and Erdoğan’s other opponents hoped that they could hold the President to under fifty per cent on Sunday and then, in a runoff, ride a newfound momentum to an upset victory.

It was not to be. Erdoğan declared a win in the first round, claiming fifty-three per cent of the votes cast. In a speech in Istanbul, he appeared already to have moved on. “Citizens have cast their votes and spoken clearly,’’ he said.

Assuming that his victory holds, Erdoğan will stand firmly in the ranks of authoritarian leaders around the world—including Viktor Orbán, of Hungary, and Andrzej Duda, of Poland—who are using the cover of elections to undermine the other institutions that make a liberal democracy work. By virtue of a block of constitutional amendments narrowly approved in a referendum last year, and of Sunday’s victory, Erdoğan will have more power than ever.

The wonder was that there was any suspense at all: as a candidate, Erdoğan got nearly all the media attention, but he also sent one of his main opponents, Selahattin Demirtaş, of the Kurdish People’s Democratic Party, to prison on a trumped-up charge of terrorism. Indeed, it’s a testament to the Turkish people that so many refused to give up on the idea of democratic rule.

Erdoğan came to power in 2003, after having spent time as Istanbul’s mayor and in prison as a political prisoner. (He had recited a poem that appeared to advocate militant Islam.) For a pious Muslim politician in Turkey, the duality was unremarkable: since the nation’s founding, in 1923, it had been ruled by a pro-Western secular élite that relied on the military to keep it in power—and Islamists and Communists out. With the end of the Cold War, Turkey began to liberalize and, in 2002, Erdoğan’s party, known by its Turkish initials, the A.K.P., swept to power.

At the time—just after the 9/11 attacks, just before the invasion of Iraq—the West and, particularly, the United States were desperate for friends in the Islamic world. The Europeans offered Turkey membership in the European Union, and the Bush and Obama Administrations embraced Erdoğan for his seeming moderation. “Before anything else, I’m a Muslim,’’ he told the Times Magazine shortly after becoming Prime Minister, in 2003. “As a Muslim, I try to comply with the requirements of my religion. I have a responsibility to God, who created me, and I try to fulfill that responsibility. But I try now very much to keep this away from political life, to keep it private.” Indeed, Erdoğan seemed to realize that the West’s obsession with militant Islam gave him the freedom to pursue his real agenda—to gain more power for himself.

His first anti-democratic campaign began in 2008, with trials of members of the military and the secular establishment charged with attempting to foment a coup. The cases were known by their unusual code names, Sledgehammer and Ergenekon. I remember going through the evidence in both cases—page after page of indictments, charges, and transcripts—and being astounded at how preposterous much of the evidence appeared.

It felt as if I were sitting in a courtroom in Eastern Europe in the nineteen-forties, or the Soviet Union in the nineteen-thirties. Unlike in those earlier regimes, Erdoğan did not have his opponents shot, but the prosecutions led to the imprisonment of hundreds of officers, journalists, and intellectuals.

The second campaign began in 2016, in the aftermath of a failed coup in which dozens of Turks were killed. Much remains unknown about the attempt, but it was staged by disgruntled military officers and members of the Gulenist religious group, whose leader, Fethullah Gülen, lives in exile in Pennsylvania. (Gülen has denied involvement.)

In the nearly two years since, Erdoğan has jailed as many as forty thousand people—most of them without trial—including judges, journalists, academics, and members of parliament. The free press has been decimated, as has the independent judiciary.

Under such conditions, is it any wonder that Erdoğan won? That’s the real lesson of Sunday’s election—that, in Turkey, as in Russia and Hungary and Poland, there’s more to democracy than just elections.

The only question left is how long Erdoğan will stay. He is only sixty-four; although many believed that he had undergone cancer treatment, in 2012, he has said that he did not have the disease, and he is, by all accounts, tireless and enthusiastic. But he is showing the telltale signs of a late-stage autocrat. His love of grandiose construction projects—a canal stretching from the Black Sea to the Sea of Marmara; his eleven-hundred-room, six-hundred-million-dollar palace—bespeak a monarch whose sense of importance has begun to border on the absolute.

Leaders who no can longer tolerate being questioned usually end up making terrible errors. Erdoğan may yet do so. The Turkish economy is heading toward a recession, and, during the campaign, he promised that if he won he would take control of the country’s Central Bank. Throughout history, when a country’s populist autocrat gets control of that institution, chaos is usually not far away.

For Turkey’s sake, let’s hope that something slows him down. In any case, when Erdoğan finally leaves office, the Turkish people will find that much of what had once held their country together has been dismantled or severely degraded. That’s when the real work of rebuilding Turkey’s democracy will begin.