Dado Ruvic/Reuters

ISTANBUL — Recep Tayyip Erdogan bent the constitution and election rules in a drive to become the all-powerful leader of this strategically important NATO country. But in parliamentary election on Sunday, Erdogan saw his high hopes come crashing down to earth as voters dealt him the first national defeat of his career.

Erdogan critics said the vote was a watershed moment for Turkey as the country spoke out against a leader who wanted all power for himself.

“The era of Erdogan is over,” declared historian Ahmet Insel.

Going into Sunday’s poll, Erdogan had called on voters to give his ruling party AKP at least 330 deputies in parliament in order to change the constitution and introduce a presidential system with him at the helm. As Erdogan’s plan did not include checks and balances to limit executive power, the opposition called the move a dictatorial power grab—and voters agreed. Not only did the AKP fail to reach the 330 deputies demanded by Erdogan, it lost so many votes on Sunday that it dropped down to 256 lawmakers; at least 276 are needed to form a majority government. “AKP government is history, Super President is history,” tweeted journalist Yusuf Kanli.

The small pro-Kurdish party HDP, which had presented itself as the bulwark against Erdogan’s idea of an executive presidency, received 12.9 percent of the vote and will have 79 deputies in the new parliament. The HDP’s result was critical because it managed to overcome Turkey’s unusually high 10 percent bar for political parties to enter parliament and, thus, sealed the AKP’s fate.

Two other parties, the secularist CHP and the nationalist MHP, are also represented in parliament and might form a new government with outside support from the HDP. The result would be a French-style “cohabitation,” with a president forced to work with a government made up of his political foes.

For Erdogan personally, the election result is far worse than just a drop in votes or a loss of a parliamentary majority. “This election was a referendum on Recep Tayyip Erdogan,” Insel told the CNN-Turk news channel. “Voters said: It’s enough.” Marc Pierini, a former European Union ambassador to Ankara, wrote on Twitter that Turkish voters had used the election for a “rebalancing of forces.”

Erdogan, 61, has dominated Turkey’s political scene for more than a decade. Hailed as a reformer when he became prime minister in 2003, he put the country’s economy on track toward spectacular growth rates, started membership talks with the EU and clipped the political power of Turkey’s generals. But as time went on, Erdogan became more authoritarian, a trend that worsened after he was elected president last year and which led some critics to wonder whether he has lost his mind.

Hated by critics but loved by his conservative Muslim followers in Anatolia, Erdogan then embarked on his project to give himself wide-ranging powers as head of state, a venture HDP leader Selahattin Demirtas called a plan to erect a “constitutional dictatorship.” Although the constitution says the president should be above party politics, Erdogan threw himself into the election campaign for the AKP, attacking opposition leaders as “liars” and sidelining official party leader and Prime Minister Ahmet Davutoglu.

On the eve of the vote, Erdogan’s intolerance for criticism grew to the point that he personally took the editor of an opposition newspaper to court because of the paper’s reporting about the alleged delivery of Turkish weapons to radical groups in Syria. The prosecution is now seeking a life sentence for the editor, Can Dundar.

Some Turks hope that Sunday’s elections had put an end to Erdogan’s excesses. Mustafa Akyol, a commentator specializing in political Islam, told CNN-Turk the AKP had lost the election because voters had the feeling the AKP wanted to “re-invent Turkey in the name of one man only.” HDP leader Demirtas said that “the debate about the executive presidency and dictatorship is over.” Suat Kiniklioglu, a former parliamentary deputy turned newspaper columnist, commented that Turkey had averted “further authoritarianism” by reducing the AKP’s strength.

Erdogan himself made no public appearance after the election results were published, but even some of his strongest supporters in the media admitted that the president could not go on like before. The plan for an executive presidency “will be shelved,” pro-government columnist Mehmet Barlas told the news channel NTV.

The big question is what Erdogan will do next. As the AKP no longer has a majority in parliament, political parties will try to put together a coalition government. If they fail, Erdogan can send the country to the polls again in the coming months.

Prime Minister Davutoglu said the AKP had no intention of ceding political power to its opponents but was ready to talk about coalitions. “We are in power and will remain so,” he said in a speech after the election.