The final result was announced by the Afghan Independent Election Commission Chairperson Hawa Alam Nuristani on Tuesday.
Ghani secured 50.64% of total eligible votes, according to Nuristani. Abdullah Abdullah, the Chief Executive of Afghanistan, came second with 39.51% of the votes.
The results were delayed because of widespread allegations of fraud, which meant that hundreds of thousands of votes had to undergo recounts and an auditing process.
A former academic who previously taught at Berkeley and Johns Hopkins University in the United States, Ghani used to be an American citizen until he gave up his passport to run for the Afghan presidency in 2009.
The US is aiming for a peace deal to help execute President Donald Trump’s desire to withdraw US troops from Afghanistan. The first step is expected to reduce the current level of troops from 12-13,000 to 8,600.
Speaking at the Munich Security Conference, Esper affirmed that US forces will remain in Afghanistan “as long as necessary” to support their Afghan partners, clarifying that any reduction in forces will be conditions-based.
NATO Secretary General Jens Stoltenberg said earlier on Saturday that NATO and the US are prepared to reduce their military presence in Afghanistan if the Taliban demonstrates a willingness to reduce violence and come to the negotiating table.