In the wake of its worst-ever electoral setback, Turkey's former ruling party, the AKP, faces a protracted analysis of what went wrong during its parliamentary election campaign — a debate that is expected to reveal a deep rift within its ranks.

Supporters of President Recep Tayyip Erdogan are already blaming the setback on the lackluster campaign of the party's leader, Ahmet Davutoglu, while pragmatic wing of the party is expected to call for a change in direction.

The election deprived the AKP of its parliamentary majority, thereby derailing Erdogan's plans to change the constitution to extend his grip on power.

In his first televised speech since Sunday's election, Erdogan urged all four parties represented in parliament not to leave the country in limbo and to quickly form a new government.

Meanwhile, Davutoglu announced the AKP is dropping its bid to create an executive presidency, saying the electorate had given its verdict.

Davutoglu resigned as the country's prime minister Tuesday in a procedural move that will leave him in the post until a new government is formed.

Yuksel Taskin, a political scientist at Istanbul’s Marmara University, said in the wake of the election setback, Davutoglu "couldn't establish his own game" and "had to comply with Erdogan."

"There was a 20 percent loss of votes and 20 percent loss of seats compared to 2011," he said. "So Davutoglu cannot continue like this. He has to show that he is in command. So he has to show some signs of power and initiative. So there could be certain internal tensions within the party."

Many AKP parliamentary deputies are loyal to Erdogan; and they are likely to blame Davutoglu for lackluster campaigning that cost the party votes.

Some analysts say the AKP could choose a new leader at a party congress scheduled for September. An ally of the president, Numan Kurtulmus, is widely tipped as a possible replacement.

Another potential key player is former President Abdullah Gul, a founding member of the AKP. Gul was frozen out of the party after he voiced concern over President Erdogan's authoritarian tendencies and government policies.

Political scientist Taskin said Gul could be a key player in a struggle for dominance inside the party.

"I believe from now on Abdullah Gul will be more assertive," he said. "His strategy would be like this: 'I warned you. You left the moderate way and you created an over ideologized discourse. So these are the outcomes'."

But Cengiz Aktar, a political scientist at Istanbul's Suleyman Sah University, said the magnitude of the electoral setback could weaken the normally disciplined Islamist-rooted AKP.

"In political Islam, people don't show to the public their dissension," he said. "Now that they‘ve had a slap in face, the dissension may show."

And history could have important lessons for the AKP.

In the 1980s, the ANAP, or Motherland Party, dominated Turkish politics under its charismatic leader, Turgut Ozal, who served as both president and prime minister. However, the party lost its parliamentary majority after Ozal became president, and fell into into division and eventual decline.

Now, the AKP is facing a critical juncture, said Sinan Ulgen, visiting scholar at Carnegie Europe in Brussels.

"Certainly, Turkey’s political history has demonstrated time and again that when a party loses political power, and especially if it loses their initial charismatic leadership, they have a difficult time maintaining their integrity," he said. "That is certainly a risk factor going forward for the AK Party."

With the AKP set to hold a party congress in September, the coming months are likely to see a battle for the heart and soul of the party. The former ruling party's decade of domination of center-right politics in Turkey has blocked the formation of traditional secular right-wing parties.