AP - In a stunning blow to President Recep Tayyip Erdogan, preliminary results from Turkey's parliamentary election on Sunday show that his party would lose its simple majority in Parliament.

With 99.9 percent of the vote counted, Erdogan's ruling Justice and Development Party, the AKP, had the support of around 41 percent of voters, according to state-run TRT television. According to projections, that would give it some 258 seats — 18 below the minimum needed to keep its majority.

In an indication of how precipitously Erdogan's fortunes have fallen in the campaign, he had begun the campaign asking voters for 400 seats, a massive majority that would have allowed the party to change the constitution to give the presidency extraordinary powers. AKP would have needed a majority of 330 seats of the total 550 to call for a national referendum to change the constitution.

In the biggest setback to the ruling party's chances, the main Kurdish party was running at about 12 percent — above the 10 percent minimum threshold for representation in Parliament.

The main secular opposition Republican Peoples Party, or CHP was seen getting about 25 percent of the vote, while the nationalist MHP was expected to get under 17 percent.

AKP received around 49 percent of the vote in general elections in 2011. The setback would be first time that the party is faced with falling short of a majority to rule alone since it swept into power in 2002.

"Erdogan turned the election into a referendum on his personal ambitions," said Fadi Hakura, a Turkey specialist at London-based Chatham House. "These elections have put his plans on the back burner for a very long time."

Erdogan himself was not on the ballot. Still, the election was effectively a referendum on whether to endow his office with powers that would significantly change Turkey's democracy and prolong his reign as the country's most powerful politician.

HDP's apparent leap above the 10 percent threshold, would vault it into a significant position in the Parliament, winning seats greatly at the cost of the ruling party's current majority and making constitutional change on AKP's terms unlikely.

Sirri Sureyya Onder, a senior HDP official, who won a seat in Ankara said the party would not celebrate its breakthrough in order to avoid provoking opponents, but he took an apparent shot at the ruling party.

"This is the victory of democracy over loutishness, of freedom over oppression, of modesty over conceit, of peace over war," he said.

The HDP seemed to have made considerable gains in southeast Turkey, suggesting that religious Kurds had turned away from AKP in favor of HDP.

AKP also appeared to have lost votes in Sanliurfa and Gaziantep where there are large numbers of Syrian refugees.

The vote came amid high tensions after bombings Friday during a HDP rally killed two people and wounded scores. On Sunday, Davutoglu said a suspect had been detained in the case, but provided no other details.

HDP leader Selahattin Demirtas called his party's ability to cross the threshold a "fabulous victory for peace and freedoms" that came despite the attack on his party and fierce campaigning by Erdogan.

"As of now the discussions on a presidential system, a dictatorship has come to an end," he said.

Selahattin Demirtas, co-chairman of the pro-Kurdish Peoples' Democratic Party, casts his ballot in Istanbul, June 7, 2015. (Reuters)

Aside from the constitutional issues, the election could have a major impact on the peace process to end decades of insurgency by Kurdish militants in Turkey.

Scuffles between rival party supporters were reported in at least two provinces Sunday, including one in Sanliurfa which injured 15 people.

Erdogan has been Turkey's dominant politician since his party swept into power in 2002 — becoming prime minister in 2003 and leading his party to two overwhelming parliamentary election victories. In a gamble last year, he decided to run for president, banking that his party could later bolster his powers.

Under the current constitution, Erdogan is meant to stay above the political fray as president. But he has been campaigning vociferously, drawing complaints from the opposition that he is ignoring the constitution.

"The true loser of this election is Erdogan," said Haluk Koc, a deputy leader of the main opposition CHP party. "Turkey won."

As he cast his vote Sunday, Erdogan praised the election as an indication of the strength of democracy in Turkey.

"This strong democracy will be confirmed with the will of our people and extend the trust we have in our future," Erdogan said.

His party appears to have fallen well short of what it expected — a development that could leave Erdogan stranded in the presidential palace without the powers he has long sought.

After the final official results are confirmed there is a 45-day period in which a new government needs to be formed, or new elections are called.