Fifteen years ago, Turkish President Recep Tayyip Erdoğan was the hope of the Islamic world. He was an Islamist, of course, but that was part of his appeal. As the mayor of Istanbul, one of the world’s great cities, Erdoğan had governed as a charismatic and smart technocrat. He’d served time in prison, in 1999—for reading a poem that seemed to celebrate militant Islam—but his jailers had been the country’s rigid, military-backed secular leaders who, by then, seemed as suited to the present day as dinosaurs. When Erdoğan became Prime Minister, in 2003, every leader in the West wanted him to succeed. In a world still trying to make sense of the 9/11 attacks, he seemed like a bridge between cultures.

On Sunday, Erdoğan declared himself the winner of a nationwide referendum that all but brings Turkish democracy to an end. The vast new powers granted to Erdoğan—wide control over the judiciary, broad powers to make law by decree, the abolition of the office of the Prime Minister and of Turkey’s parliamentary system—effectively make him a dictator. Under the new rules, Erdoğan will be able to run for two more five-year terms, giving him potentially another decade in power, at least. With a vote by the now truncated parliament, he would be able to run for yet another term, one that would end in 2034. By then, he’ll be an old man.

The voting took place in a government-created atmosphere of violence, intimidation, and fear. Turks campaigning against the referendum were attacked and even shot at. For much of the past year, Erdoğan’s government has been working to stamp out what remained of the democratic opposition to his rule. Since July, some forty thousand people have been detained, including a hundred and fifty journalists. A hundred thousand government employees have been fired, and a hundred and seventy-nine television stations, newspapers, and other media outlets have been closed. Many opposition leaders are in jail. That’s not an environment conducive to asking a populace what it wants.

The vote was close—very close—and there are many accusations of fraud. It did seem hard, in the lead-up to Sunday, to imagine that Erdoğan would allow himself to lose. (He did not even permit international observers to monitor the vote.) In the end, to solidify his position, Erdoğan was compelled to strike an unlikely deal with the M.P.H., an ultra-nationalist party that had previously opposed him. Without the ultra-nationalists, who can’t be expected to be enduring Erdoğan allies, the referendum vote may well have failed. Not that it will matter much now—the margin may have been close, but you can expect Erdoğan to exercise his new prerogatives fully. “It means the country is totally split,’’ James Jeffrey, a former U.S. Ambassador to Turkey, told me. “Half the country loves him, and half the country loathes him.”

The secret to Erdoğan, I think, is that his Islamism has always been a diversion; what he cares about is not so much the power of his religion as power for himself. This has been true at least since the beginning of his second term as Prime Minster. It was then, in 2007, that his government opened the first in a series of investigations aimed at rooting out what he described as a vast, secret cabal—dubbed “Ergenekon”—composed of the secular élite that had historically dominated Turkey. As it turned out, Ergenekon was just another name for the democratic opposition and members of the military who regarded Erdoğan with suspicion. At the time, the Ergenekon prosecutions made a certain sense: in Turkey, the secular élite and its allies in the military had such a history of repression that much of the world seemed prepared to believe Erdoğan, or at least to give him the benefit of the doubt. But the trials—which began the dismantling, which continues to this day, of the secular democratic opposition—were a farce.

Since then, Erdoğan has used one trumped-up enemy after another to justify his drive for absolute power. In 2013 came the Gezi Park protests, where Turkish police cracked down on peaceful demonstrators, killing several people and injuring thousands more. Then, last July, Erdoğan beat back an attempted military coup against him, then exploited the crisis to neutralize any remaining opposition. Erdoğan’s strongman tactics worked in no small part because of the acquiescence of the United States and Europe, whose governments have held off criticizing Erdoğan for fear that he might get worse.

For years, Erdoğan’s critics attributed to him a damning quotation that, they said, revealed his true intentions. “Democracy is like a train,’’ Erdoğan was said to have remarked. “You get off once you’ve reached your destination.” It’s not clear that Erdoğan ever actually said this. But it seems, in 2017, to reflect precisely what he has had in mind all along. After fifteen years of riding the train of democracy, Erdoğan and Turkey are finally stepping off.