The Afghan Independent Election Commission has officially named former Finance Minister Ashraf Ghani as the new president of Afghanistan.
The commission -- which said the vote had "grave" flaws -- did not provide a final vote tally of the disputed June runoff election.
The announcement came hours after Ghani and rival Abdullah Abdullah signed a power-sharing agreement to form a unity government in which Ghani was made president and Abdullah is expected to take a new position known as the chief executive officer.
The agreement ends months of dispute over the election results in which Abdullah and Ghani accused each other of fraud.
Abdullah won the first-round of the election with 45 percent of the vote.
Independent Election Commission Chairman Ahmad Yusuf Nuristani said a UN audit of the runoff election did not detect all of the flaws in the vote.
The deal was reportedly agreed to late on September 20.
The two men embraced after the signing ceremony -- broadcast live on Afghan television --after which President Hamid Karzai spoke.
Karzai congratulated the two men and said he hoped Afghanistan would experience "peace and prosperity."
Karzai spokesman Aimal Faizi said Ghani was due to be sworn in as president within a week.
WATCH: Afghanistan's rival presidential candidates sign a deal on to share power after months of disputes over the elections in June. Ashraf Ghani and Abdullah Abdullah embraced after signing the agreement at a ceremony in Kabul, where outgoing President Hamid Karzai welcomed the deal. (Reuters)
White House Praises 'Statesmanship'
The Obama administration has praised the signing of the power-sharing deal.
A White House statement says the agreement will help bring "closure" to the country's political crisis and restore "confidence in the way forward."
U.S. Secretary of State John Kerry said the deal was a "moment of extraordinary statesmanship."
He added that Abdullah and Ghani had put "the people of Afghanistan first, and they've ensured that the first peaceful democratic transition in the history of their country begins with national unity."
Washington needs the new president to sign an already negotiated agreement on the keeping of a residual U.S. security force in Afghanistan after the withdrawal of U.S.-led military forces in the country at the end of this year.
Karzai has refused to sign the U.S.-Afghan security agreement.
Disputed Vote Count
Ballots were first cast in April and again in a June runoff, but no winner has been decided amid allegations of widespread electoral fraud.
The UN-sponsored audit of the millions of votes was carried out but the results not publicly announced.
Both Ghani and Abdullah claimed to have won the election, and the United Nations and the United States have pushed for a "national unity government" to try to avoid violence and ethnic divisions.
Former Foreign Minister Abdullah won the first round of voting in April but did not get enough votes to avoid a runoff.
According to a preliminary count, former Finance Minister Ghani took the second round.
U.S. Ambassador James Cunningham brokered talks between Abdullah and Ghani on September 18, a day after negotiations on forming the unity government stalled in a dispute over when and how to release the final election results.
Rahimi said late on September 17 that Abdullah would quit talks on a unity government if the audit results were released before the candidates reached a deal.
Rahimi also said Abdullah wanted the auditors to invalidate more of the ballots cast for Ghani.
Ghani rejected that demand.