Turkey's long-dominant Justice and Development Party (AKP) has scored a stunning electoral comeback, regaining its parliamentary majority in a poll seen as crucial for the future of the troubled country.
The party founded by President Recep Tayyip Erdogan on Sunday won over 49 percent of the vote to secure 315 seats in the 550-member parliament with nearly all votes counted, easily enough to form a government on its own.
"Today is a day of victory," a beaming Prime Minister Ahmet Davutoglu told a crowd of supporters in his hometown. "The victory belongs to the people."
The outcome was a shock to many as opinion polls had predicted a replay of the June election when the AKP won only 40 percent of the vote and lost its majority for the first time in 13 years.
It is a huge personal victory for 61-year-old Erdogan, Turkey's divisive strongman who may now be able to secure enough support for his controversial ambitions to expand his role into a powerful US-style executive presidency.
Turks voted in large numbers, with the country deeply polarised in the face of renewed Kurdish violence and a wave of bloody jihadist attacks along with mounting concerns about democracy and the faltering economy.
Underscoring a key challenge for a new AKP administration, police fired tear gas and water cannon on protesting Kurdish militants who set fire to tyres and pallets in the main Kurdish city of Diyarbakir.
Many Turks are fearful of a return to all-out war with outlawed Kurdistan Workers' Party (PKK) rebels after fresh violence shattered a 2013 truce in July, just a month after a pro-Kurdish party won seats for the first time and denied Erdogan's AKP a majority.
This time round, the People's Democratic Party (HDP), led by charismatic lawyer Selahattin Demirtas, lost support but appeared to have scraped over the 10 percent threshold to stay in parliament.
The vote for the Nationalist Movement Party (MHP) fell to around 11 percent from 16 percent in June, with commentators suggesting its supporters had shifted to the AKP.
The main opposition Republican People's Party (CHP) had about 23 percent.
The threat of further jihadist violence had overshadowed the poll after a string of attacks blamed on the Islamic State group, including twin suicide bombings on an Ankara peace rally last month that killed 102 people - the bloodiest in Turkey's modern history.
A string of high-profile raids against media groups deemed hostile to Erdogan and the jailing of critical journalists have set alarm bells ringing about the state of democracy in a country that has long aspired to join the European Union.
Turkey is also struggling with its policy on neighbouring Syria which has left it at odds with its NATO allies, and the burden of more than two million Syrian refugees.
After long supporting rebels fighting the Damascus regime, Ankara was cajoled into joining the US-led coalition against the IS group and launched its own "war on terrorism" targeting the jihadists as well as PKK fighters.
Turkey's economy is also in trouble, with growth slowing sharply, unemployment rising and the Turkish lira plunging more than 25 percent in value this year.