The Afghan Independent Election Commission has officially named former Finance Minister Ashraf Ghani as the new president of Afghanistan following a breakthrough power-sharing deal between the two leading candidates.
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 the deal 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.
Abdullah could also appoint someone else to the post.
Outgoing President Hamid Karzai's spokesman, Aimal Faizi, said Ghani will be sworn in as president within a week.
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.
But he said the commission had a duty to declare a winner.
The two men embraced after the signing ceremony -- broadcast live on Afghan television -- after which Karzai spoke.
Karzai congratulated the two men and said he hoped Afghanistan would experience "peace and prosperity."
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 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, whose shuttle diplomacy in recent months helped salvage the vote process amid signs it could crumble, 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.
In New York, the UN Security Council issued a press statement welcoming the "conclusion of Afghanistan's presidential election," adding that member countries looked forward to working with the new "Government of National Unity."
NATO said that it hoped both leaders could move forward "in the spirit of genuine political partnership."
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.