Turkey's Islamic-rooted ruling party lost its parliamentary majority in Sunday's legislative elections, dealing a severe blow to strongman President Recep Tayyip Erdogan's ambition to expand his powers.

The Justice and Development Party (AKP) won the biggest share of the vote in the closely-fought elections, but lost almost 10 percentonthe nearly 50 percent it recorded in the previous 2011 polls.

Under Turkey's proportional representation system, this means the AKP will need to form a coalition for the first time since coming to power in 2002.

READ: Turkey braces for tense polls after deadly attack

In another sensational result that shakes-up Turkey's political landscape, the pro-Kurdish People's Democratic Party (HDP) easily surpassed the 10-percent barrier needed to send MPs to parliament.

Official results based on 99.9 percent of votes counted gave the AKP 41 percent of Sunday's ballots, followed by the Republican People's Party (CHP) on 25 percent, the Nationalist Movement Party (MHP) on 16.5 percent and the HDP in fourth place with 13 percent.

Turnout stood at 86 percent.

According to the official projections, the AKP will have 258 seats in the 550-seat parliament, the CHP 132, the MHP 81 and the HDP 79.

The AKP has dominated Turkish politics since it first came to power in 2002 but has suffered from a dip in economic growth and controversy over Erdogan's perceived authoritarian tendencies.

The results wreck Erdogan's dream of agreeing a new constitution to switch Turkey from a parliamentary to a presidential system that he had made a fundamental issue in the campaign.

Such a change would have required a two-thirds majority in the parliament.

Erdogan -- premier from 2003-2014 before becoming president -- wanted to be enshrined as Turkey's most powerful figure and strengthen the office of the presidency which was largely ceremonial until his arrival.

Opponents, however, feared it could mark the start of one-man rule, with Erdogan likely to seek another presidential mandate to stay in power until 2024.

Speaking from the balcony of AKP headquarters in Ankara -- the traditional place for the party's victory speeches,Prime Ministerand party leader Ahmet Davutoglu sought to put a brave face on the results.

"The winner of the election is again the AKP, there's no doubt," he said, pledging to ensure Turkey's stability.

But he added: "Our people's decision is final. It's above everything and we will act in line with it."


'HDP's tremendous victory'


The result was a triumph for the HDP, which in the campaign had sought to present itself as a genuinely Turkish party and reach out to voters beyond its main Kurdish support base to secular Turks, women and gays.

It was also a personal victory for the party's charismatic leader Selahattin Demirtas, dubbed the "Kurdish Obama" by someforhis silky rhetorical skills and who had been repeatedly attacked by Erdogan in the campaign.

"We, as the oppressed people of Turkey who want justice, peace and freedom, have achieved a tremendous victory today," Demirtas told a news conference in Istanbul.

"Now the HDP is a real party of Turkey. HDP is Turkey and Turkey is HDP," he said.

He said there would be no coalition with the AKP and instead the HDP would make a "strong and honest opposition".

HDP MPs had sat in the previousparliament butthey had been elected as independents and not from a party list.

In Turkey's main Kurdish city of Diyarbakir, cars massed in the streets, with drivers honking and people hanging out ofwindows making'V' signs as gunshots were fired into the air.

Analysts see the nationalist MHP as the most likely coalition partner for the AKP in the new parliament.

The MHP's leader Devlet Bahceli did not shut the door on acoalition butsaid the results represented the "beginning of the end for the AKP".

Should the sides fail to form a coalition, new elections could be a real possibility and by law could be called any time 45 days from now.

Erdogan's heavy involvement in the campaign infavourof the AKP had been controversial, given that as head of state he is required to keep an equal distance from all parties.

The legislative election took place under the shadow of violence, after two people were killed and dozens more wounded in an attack on a rally of the HDP in Diyarbakir on Friday.

Davutoglusaid one suspect had been arrested over the attack and was being checked for links to militant groups.

In Diyarbakir, several people who were wounded in the attack, some with their legs in plaster and heads in bandages, defied their injuries to vote, AFP correspondents said.