Turkey’s AK party faces a challenge to form a government after losing its majority at a general election for the first time in 13 years.
It secured 41%, a sharp drop from 2011, when it won nearly half of the vote.
Under Turkey’s proportional representation system, this means the AKP will need to form a coalition or face entering a minority government.
The pro-Kurdish HDP crossed the 10% threshold, securing seats in parliament for the first time.
There were jubilant scenes as the party’s supporters took to the streets chanting “we are the HDP, we are going to the parliament”.
“It is a carnival night,” 47-year-old Huseyin Durmaz told AFP. “We no longer trust the AKP.”
HDP leader Selahattin Demirtas ruled out entering into a coalition with the AKP, pointing out that the election results had put an end to discussions about a presidential system.
The result is a blow to President Recep Tayyip Erdogan’s plans to boost his office’s powers.
He first came to power as prime minister in 2003 and had been seeking a two-thirds majority to turn Turkey into a presidential republic.
“The discussion of executive presidency and dictatorship have come to an end in Turkey with these elections,” Mr Demirtas told a news conference in Istanbul.
Speaking from the balcony of the AKP headquarters in Ankara Prime Minister Ahmet Davutoglu said: “The winner of the election is again the AKP, there’s no doubt.”
But he added: “Our people’s decision is final. It’s above everything and we will act in line with it.”
The BBC’s Mark Lowen in Istanbul
The AKP has polled worse than it ever feared and lost its majority. President Erdogan will be unable to change the constitution and extend his powers.
It’s a stark contrast with the HDP, which gambled to run as a single party for the first time, hoping to cross the 10% threshold. It paid off, gaining a significant voice for the Kurdish minority on the national stage.
It succeeded by appealing beyond the Kurds, drawing in leftists and staunch Erdogan opponents with its message of equality, gay rights and environmental concerns.
This could be the start of a new political era here; a major setback for a president who has polarised this nation.
In a volatile Middle East, Turkey matters greatly – and so the path it takes, the nature of its democracy and the leaders it produces, all have implications far beyond its borders.
With nearly all the votes counted, the AKP looks likely to win 258 seats in parliament, 18 fewer than it requires for a majority.
The Republican People’s Party (CHP) looks set to be the second largest party, as in the previous parliament, polling around 25% of the vote.
In third place is the Nationalist Movement Party (MHP) on 16.5% and People’s Democratic Party (HDP) in fourth place with 13%.
The HDP is expected to finish with 75 to 80 seats after successfully attracting votes beyond its Kurdish support base.
The MHP’s leader Devlet Bahceli did not rule out the possibility of entering a coalition government, but said the results represented the “beginning of the end for the AKP”.
Once viewed as invincible President Erdogan’s party has been criticised in recent years for its clampdown on free speech and its growing authoritarianism.