ANKARA, May 28 (Reuters) - 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.