Turkish President Tayyip Erdogan looks on after arriving at Esenboga Airport, in Ankara, Turkey, June 8, 2015. Turkey faced the prospect of weeks of political turmoil after the ruling AK Party lost its parliamentary majority. REUTERS/Umit Bektas (Umit Bektas/Reuters)

Turkey’s president and his political allies began the difficult process of damage assessment Monday after being upended by a dramatic election shift that wiped away their hold on parliament.

President Recep Tayyip Erdogan’s Justice and Development Party won only 258 of the 550 seats in the Grand National Assembly, after having secured 327 in the 2011 vote. The center-right party, known by its Turkish abbreviation AKP, has been the country’s dominant political force since 2002.

With none of Turkey’s four main parties winning a clear majority in Sunday’s parliamentary election, analysts expect that it will take days, perhaps weeks, of wrangling to form a coalition government. If those efforts fail, a new election is likely.

In any event, said Soner Cagap­tay, a Turkey scholar at the Washington Institute for Near East Policy, it is a near certainty that any government that emerges will not last long.

“Never once in Turkish history has a coalition or minority government lasted its full mandate,” Cagaptay said. “All roads lead to an early election.”

The political uncertainty led Turkey’s main stock index to drop 8 percent, while the lira fell to a record low against the U.S. dollar.

Erdogan, who served three terms as prime minister before being elected president last year, technically had no part in the election. But many voters viewed the vote as a referendum on his larger political ambitions.

Erdogan hoped to secure a ­supermajority in parliament to push through a new constitution that would scrap Turkey’s parliamentary structure for a presidential system akin to the one in the United States — which would give him greater executive powers and entail fewer checks and balances.

The AKP, which has strong backing among a vast population of conservative and religious Turks, still won the most votes in the election. But the loss of a parliamentary majority was seen as a disaster for Erdogan and Prime Minister Ahmet Davutoglu, who had the awkward task of leading an election campaign that pushed for the elimination of his own job. The AKP’s rivals all oppose Erdogan’s vision of a presidential system.

It is not clear whether Erdogan has learned any lessons from this electoral chastening and whether it will deepen the authoritarian style that critics say had come to characterize recent years of AKP governance.

Few expect him to voluntarily back down and accept the largely ceremonial role that the current Turkish constitution mandates for the president.

Supporters of Turkey's ruling Justice and Development Party celebrate over the election results in Istanbul,Turkey, late Sunday, June 7, 2015. (AP Photo/Emrah Gurel) (Emrah Gurel/AP)

“The big question is: ‘What is Erdogan calculating in his palace?’ ” says Mustafa Akyol, a columnist for Hurriyet Daily News, an English-language newspaper based in Istanbul.

On Monday, Erdogan issued a conciliatory message on his official Web site.

“I believe that the current situation, which did not permit any party to form a government on its own, will be evaluated healthily and realistically by all parties that have taken part in the race,” he said.

He also applauded the “precious nation’s determination for democracy and for reflecting its will at the ballot box.”

The biggest winner of the election was the Peoples’ Democratic Party, or HDP, which came in fourth with about 13 percent of the vote. It was the first time the HDP had cleared the 10 percent barrier for entry into parliament.

The strong showing by the leftist party, which is dominated by Kurds but also backed by an array of liberals and secularists opposed to AKP rule, played a huge role in depriving Erdogan of the majority. The HDP’s performance — under the leadership of the charismatic Selahattin Demirtas — was hailed as a sign of Turkey’s maturing politics.

The HDP, after all, has direct ties to the Kurdistan Workers’ Party, or the PKK, the Kurdish organization that was locked in a three-decade war against the Turkish state and is considered a terrorist group by the United States and Turkey.

“It shows that Turkey can withstand a greater degree of pluralism without having its democracy endangered,” says Michael Werz, a senior fellow at the Center for American Progress.

There are hopes that with the HDP now ensconced in parliament, the stalled peace process between the PKK and Ankara can be revived and that the aspirations of Turkey’s Kurds, who make up a fifth of the country’s population, can be better recognized.

That may all unravel if the AKP forges an alliance with the other party that ate into its vote share — the Nationalist Movement Party, or MHP, a far-right party that is staunchly against reconciliation with the PKK.

“We stand for one religion, one flag, one nation,” said Nur Toprak­oglu, an MHP supporter, canvassing for the party in Istanbul on the eve of the election. “Any minority can survive with us as long as they are not traitors.”

An AKP-MHP coalition, Werz said, would mean that “the peace process is dead in the water.”

That, in turn, could inflame the situation in predominantly Kurdish southeastern Turkey, with battles between the Islamic State militant group and Kurdish militias in neighboring Syria and Iraq stoking Kurdish solidarity across the border. Beneath the surging wave of support for the HDP is a new generation of Kurdish nationalists.

“The last thing any of us in the region, including Turkey, needs is another conflict,” said a Western diplomat, speaking on the condition of anonymity because of the sensitivity of the subject.

Experts say that Turkey’s foreign policy, though entirely contingent on the makeup of the next government, will inevitably change in a coalition setting. A majority of Turks have disagreed with several AKP positions, including Ankara’s obsession with ousting Syrian President Bashar al-Assad, the 2013 coup in Egypt that toppled President Mohamed Morsi, and Turkey’s at times acrimonious relations with the West.

Turkey’s posture on certain issues “will likely get taken down a notch,” Cagaptay said.

The same is possibly true for Erdogan’s rhetoric. The day before the election, AKP-aligned newspapers ran headlines that warned of a “crusader alliance” of foreign enemies and atheists, aimed at undermining Turkey. It was part of the “intimidation policy” emanating from the presidential palace, Akyol said.

Now, with the AKP unable to form a government on its own, it will no longer have sole control over a host of state institutions, including the regulatory agencies that govern the Internet and judiciary. Moreover, Erdogan’s move toward an executive presidency appears to have failed.

Even if Erdogan’s rhetoric does not change, Cagaptay said, “it may be increasingly possible to just ignore him.”

Read more:

The “gold toilet” scandal

Erdogan’s backers praise his “caliph” style

How a single Instagram post could end up sending a former Miss Turkey to jail