Ankara: President Tayyip Erdogan extended his two decades in power in elections on Sunday, winning a mandate to pursue increasingly authoritarian policies which have polarised Turkey and strengthened its position as a regional military power.
His challenger, Kemal Kilicdaroglu, called it "the most unfair election in years" but did not dispute the outcome.
Official results showed Kilicdaroglu won 47.9% of the votes to Erdogan's 52.1%, pointing to a deeply divided nation.
The election had been seen as one of the most consequential yet for Turkey, with the opposition believing it had a strong chance of unseating Erdogan and reversing his policies after his popularity was hit by a cost-of-living crisis.
Instead, victory reinforced his image of invincibility, after he had already redrawn domestic, economic, security and foreign policy in the NATO member country of 85 million people.
The prospect of five more years of his rule was a major blow to opponents who accused him of undermining democracy as he amassed ever more power - a charge he denies.
In a victory speech in Ankara, Erdogan pledged to leave all disputes behind and unite behind national values and dreams but then switched gears, lashing out at the opposition and accusing Kilicdaroglu of siding with terrorists without providing evidence.
He said releasing former pro-Kurdish party leader Selahattin Demirtas, whom he branded a "terrorist," would not be possible under his governance.
Erdogan said inflation was Turkey's most urgent issue.
Kilicdaroglu's defeat will likely be mourned by Turkey's NATO allies which have been alarmed by Erdogan's ties to Russian President Vladimir Putin, who congratulated his "dear friend" on his victory.
U.S. President Joe Biden wrote on Twitter: "I look forward to continuing to work together as NATO Allies on bilateral issues and shared global challenges."
U.S. relations with Turkey have been impeded by Erdogan's objection to Sweden joining NATO as well as Ankara's close relationship with Moscow and differences over Syria.
'The only winner today is Turkey,' Erdogan says
Addressing jubilant supporters earlier from atop a bus in Istanbul, Erdogan, 69, said "the only winner today is Turkey". "I thank every single one of our people who once again gave us the responsibility to govern the country five more years," he said.
Erdogan's victory extends his tenure as the longest-serving leader since Mustafa Kemal Ataturk established modern Turkey from the ruins of the Ottoman Empire a century ago - a politically potent anniversary to be marked in October with Erdogan in charge.
Erdogan, head of the Islamist-rooted AK Party, appealed to voters with nationalist and conservative rhetoric during a divisive campaign that deflected attention from deep economic troubles.
In his victory speech, he attacked the opposition again, calling them pro-LGBT.
Kilicdaroglu, who had promised to set the country on a more democratic and collaborative path, said the vote showed people's will to change an authoritarian government. "All the means of the state were laid at the feet of one man," he said.
'Sad and disappointed'
Erdogan supporters, who gathered outside his Istanbul residence, chanted Allahu Akbar, or God is Greatest.
"I expect everything to become better," said Nisa, 28, a headscarved woman wearing a headband with Erdogan's name.
Another Erdogan supporter said Turkey would get stronger with him in office for five more years.
"There are issues, problems in every country around the world, in European countries as well ... With strong leadership we will overcome Turkey's problems as well," said the supporter who gave his name as Mert, 39, as he celebrated with his son.
Bugra Oztug, 24, who voted for Kilicdaroglu, blamed the opposition for failing to change. "I feel sad and disappointed but I am not hopeless. I still think there are people who can see the realities and truth," Oztug said.
Erdogan's performance has wrong-footed opponents who thought voters would punish him over the state's initially slow response to devastating earthquakes in February, in which more than 50,000 people died.
But in the first round of voting on May 14, which included parliamentary elections, his AK Party emerged top in 10 of the 11 provinces hit by the earthquakes, helping it to secure a parliamentary majority along with its allies.
Fears for liberties
French President Emmanuel Macron offered congratulations, saying France and Turkey had "huge challenges to face together".
The presidents of Iran, Israel, and the Saudi king were among leaders to congratulate him in the Middle East, where Erdogan has asserted Turkish influence, at times with military power. Erdogan, who was for years at odds with numerous governments in the region, has taken a more conciliatory stance in recent years.
Emre Erdogan, a political science professor at Istanbul's Bilgi University, attributed Erdogan's success to his supporters' belief "in his ability to solve problems, even though he created many of them".
Erdogan had also maintained the support of conservative voters who long felt marginalised. "This era will be characterized by a decline in political and civil liberties, polarization, and cultural fights between two political tribes," he said.
Erdogan appeared to have prevailed despite years of economic turmoil which critics blamed on unorthodox economic policies which the opposition had pledged to reverse.
Uncertainty about what an Erdogan win would mean for economic policy pushed the lira to record lows last week.
Reuters reported last week that there was disagreement within Erdogan's government over whether to stick with what some called an unsustainable economic programme or to abandon it.
Kilicdaroglu had promised to reset governance, restore human rights, and return independence to the courts and central bank after they were sidelined over the last decade.