Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.

Turkish President Recep Tayyip Erdogan secured yet another decisive mandate Sunday, winning both a new term as president and seeing an alliance led by his ruling Justice and Development Party, or AKP, maintain a majority in parliament.

Erdogan triumphed on a playing field that was far from level. He and his allies dominated a pliant Turkish media, while a state of emergency enabled the suppression of opposition forces, with some politicians campaigning from behind bars. Rights groups warned of voters cowed by a "climate of fear."

But Erdogan hailed the result, which saw close to 90 percent of Turkey's 55 million voters go to the polls, as "a lesson to the entire world on democracy." Muharrem Ince, Erdogan's nearest challenger, lamented the "unjust" nature of the election, yet conceded defeat. A galvanized opposition had shown significant unity and momentum ahead of the vote, but was still unable to loosen Erdogan's majoritarian grip.

To the outside world, the election was the latest step in Erdogan's systematic consolidation of power and his bid to transform the once-staunchly secular republic in his more religiously minded image. But while many commentators in the West (and some critics at home) resent Erdogan for his Islamist leanings, the real ideology that underpins his rule is not religion, but nationalism. In recent years, Erdogan has marshaled a populist narrative, raging against Turkey's secular elites and terrorist enemies, imagined and real, while invoking a mythic sense of the nation's past that only he could redeem. His speeches and his party's ads appeal to images of an "authentic" Turkey of loyal and happy families, often in small towns in the hinterland, while heaping calumny on the "Crusader" foes conspiring against it.

"Erdogan himself is by all indications a genuine Muslim and Islamist, yet he doesn’t seem to govern as one," Anakara-based analyst Selim Koru wrote in the Atlantic. "The Erdogan government appears far more interested in things like Islamophobia in Europe and the Israel-Palestine conflict, which give it an opportunity to face off against the West. Islamism here is not an operating principle: It is a host ideology to ressentiment."

This weaponizing of ressentiment — a term borrowed from German philosopher Friedrich Nietzsche, capturing the deep grievance produced by feelings of both envy and humiliation — is possibly the defining theme in global politics right now. And Erdogan is a master at instrumentalizing it.

"The Turkish case shows that authoritarian populists can, in the long run, prove surprisingly effective in delegitimizing anybody who disagrees with them by denigrating the opposition and telling lies about critical journalists," wrote Harvard political scientist Yascha Mounk. "It shows that, even if about half of the country deeply hates them, populists can stay in power by mobilizing a fervent base. And it also shows that political and intellectual elites, both inside the country and around the world, persistently underestimate the threat that these kinds of leaders pose to the survival of democratic institutions."

For Erdogan, a divisive nationalism has become the key path to preserving control. The AKP will have a majority in parliament only because of its alliance with the hard-right Nationalist Movement Party, or MHP, which, despite seeing a segment of its support splinter off in favor of the opposition, outperformed expectations in the parliamentary polls — likely because a significant number of AKP voters opted for them instead. Devlet Bahceli, the MHP leader, has gone from being a political dead-ender to a kingmaker.

And it also showed the hardening of the political divide between Turks willing to support Erdogan and those who want him gone. "The outcome of this election once again demonstrates that Erdogan’s strategy of polarizing the electorate works," wrote Turkish political commentator Suat Kiniklioglu. "Major shifts among the electorate occurred not between the pro-Erdogan camp and the opposition camp, but within them. The demonization of the opposition, exacerbated by Erdogan’s ultimate media dominance, has prevented major shifts from one group to the other."

For Erdogan's critics, who already fear the slow death of Turkish democracy, this spells further trouble. There are now even fewer checks to his rule. "The election Sunday completed Turkey's transition to an executive presidency, which eliminates the post of prime minister and gives the president broad governing powers, curbing the authority of both parliament and the judiciary," noted my Istanbul-based colleague Erin Cunningham.

"Erdogan’s outlook is based on a majoritarian understanding of democracy, which means that the potential for him to become even more authoritarian, now that he is armed with what he believes to be the 'will of the people,' has increased," wrote Al-Monitor's Semih Idiz. "Meanwhile, ultranationalist concerns have always trumped democratic principles, human rights and minority rights for the MHP's Bahceli, who is expected to become Erdogan’s vice president."

"The real concern isn't just that this is a tactical alliance, but really more of a mind-meld," said Nicholas Danforth, a Turkey expert speaking at a Monday panel held by the Washington Institute for Near East Policy. He added that Bahceli was in position to extract concessions from Erdogan, and likely maintain Ankara's current friction with the United States and the European Union, as well as a tough line against Kurdish factions in Turkey and Syria.

That's worrying, especially for those who hoped the Turkish president would use his newly gained authority to restart the peace process with the Kurds, calm tensions with the West and move to stabilize Turkey's rocky economy. But Erdogan is no longer the pioneering politician who shook up Turkey's sclerotic economy and delivered greater freedoms to once-marginalized pious Muslims. Instead, he's becoming an era-defining strongman and a cautionary tale to democrats elsewhere.

"How Erdogan, over the past eight years or so, dumped Turkey’s democratic experiment and grabbed up power into his greedy hands should be an object lesson to Americans," wrote Juan Cole, a left-wing historian of the Middle East. "It can happen here."

Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.