Afghanistan's election body declared Ashraf Ghani the winner of the 2019 presidential poll on Tuesday, almost five months after voting took place.
"The election commission... declares Mr Ashraf Ghani, who has won 50.64 percent of the votes, as the president of Afghanistan," election commission chief Hawa Alam Nuristani told a press conference in Kabul.
"May God help him in serving the people of Afghanistan... I also pray that peace comes to our country," she added.
The results had been delayed for nearly five months after allegations of vote-rigging from Ghani's main rival, Afghanistan's Chief Executive Abdullah Abdullah, forced a recount.
The delay left Afghanistan facing a political crisis just as the US seeks a deal with the Taliban which would allow it to withdraw troops in return for various security guarantees and a promise that the militants would hold peace talks with the Afghan government.
If all goes well, then Ghani is likely to be the man sitting across from the Taliban at the negotiating table in a bid to chart Afghanistan's future.
Earlier this week, Abdullah's team said they would not accept fraudulent results.
Current vice-president Abdul Rashid Dostum, a powerful Uzbek former warlord and Abdullah's ally, has also threatened to form a parallel government if fraudulent election results are announced.
Abdullah lost to Ghani in 2014 in a divisive election that saw the US intervene to broker an awkward power-sharing deal between the two rivals.
Nearly one million of the initial 2.7 million votes were purged owing to irregularities, meaning the election saw by far the lowest turnout of any Afghan poll.
Ultimately, only 1.8 million votes were counted -- a tiny number given Afghanistan's estimated population of 35 million and 9.6 million registered voters.