This post was updated at 7:40 a.m. ET Sunday.

Afghanistan's disputed presidential election is finally coming to a close, as the two rivals for the presidency have reached a power-sharing deal that they formally signed on Sunday.

Under the agreement, Ashraf Ghani is poised to replace the outgoing current president, Hamid Karzai. The deal will create a national unity government and delegate limited powers to the loser of the election.

Last month, NPR's Sean Carberry reported that the long drama of this election was moving at a snail's pace. "Afghans voted for a president on April 5. Then they cast ballots June 14 in a runoff between the top two candidates. Now all 8 million votes from that second round are being audited, a laborious process that includes daily arguments, occasional fistfights and yet another deadline that seems to be slipping away," he wrote.

Abdullah Abdullah came out on top in the initial election. But in the runoff, Ashraf Ghani was the front-runner, which led Abdullah to declare election fraud and launched the lengthy audit of the votes.

During the recount process, Secretary of State John Kerry met with the candidates, who then announced a plan to come to an agreement and inaugurate a president by the end of August.

Carberry reports for our Newscast division that the agreement was delayed by Abdullah's demand that the final results of the election not be made public:

"He has alleged that the U.N.-supervised audit of the vote did not eliminate what he has called industrial-scale fraud in favor of opponent Ashraf Ghani. Abdullah asked that the terms winner and loser not be used."While the details have not been released, President Karzai's spokesman says the candidates have agreed to the language for the announcement of the results. It's widely expected that Ghani will be declared Afghanistan's next president."Copyright 2016 NPR. To see more, visit