ISTANBUL — Turkish voters delivered a dramatic blow to President Recep Tayyip Erdogan and his ruling Justice Development Party Sunday after results showed it losing its majority in parliament.

And, in a historic first, a party dominated by ethnic Kurds surged into the Grand National Assembly in Ankara, marking a new moment in the evolution of Turkey’s democracy as well as a direct challenge to Erdogan’s own ambitions to consolidate power as president.

“This is a nuclear explosion in Turkish politics,” said Bulent Aliriza of the Center of Strategic and International Studies in Washington.

Erdogan had been seeking a super majority to force through constitutional change, but according to the state Anadolu news agency, his center-right AKP secured under 41 percent of the vote with 99 percent of ballots counted. Though still the biggest party in the country, the AKP suffered its worst result since 2002. It was projected to lose its majority in parliament, an astonishing turn of events for a party that has dominated Turkish politics for almost half a decade.

The AKP was expected to fall far short of the 330 seats needed to force a national referendum on Erdogan’s plan to scrap Turkey’s parliamentary structure for a presidential system, with him at the top.

“The nation’s decision is the best decision. Do not worry,” said Prime Minister Ahmet Davutoglu in a cagey post-election speech. Davutoglu was the face of the AKP’s election campaign, if not necessarily the figure pulling its strings.

The deciding factor in this election was the emergence of the Peoples’ Democratic Party, or HDP, which came in fourth with 12 percent of the vote. For a political party to enter Turkey’s parliament, it has to pass a high threshold of 10 percent of the total vote. The HDP did so, and will now command 82 seats in the 550-seat legislature, mostly at the expense of the AKP.

It’s a remarkable achievement for a party that was formed less than three years ago and has direct ties to the violent three-decade-old Kurdish separatist insurgency in Turkey’s southeast. The war between the PKK, as the Kurdish militant group is known, and the Turkish state had claimed 40,000 lives since it first flared in the early 1980s.