Ashraf Ghani secured a second term as president of Afghanistan on Tuesday, but his bitter rival Abdullah Abdullah immediately challenged final election figures and said he was forming his own government.
The results of the September 28, 2019 poll were released after lengthy delays following vote-rigging allegations by Abdullah that led to a recount.
Abdullah, who serves as Afghanistan's "chief executive" under Ghani in a tense power-sharing arrangement, said his team was "the victor".
His intent to try to form a separate government brought back memories of the angrily contested 2014 election, which also saw Ghani declared winner and Abdullah protest.
That time, Abdullah's supporters held violent demonstrations before the United States finally intervened to broker an awkward deal between the two rivals.
But more than five years on, it was not clear how much support Abdullah would get.
The United States, which is currently negotiating a withdrawal deal with the Taliban, has less interest in Afghanistan's politics than it did in 2014 under then-president Barack Obama.
And ordinary Afghans have shown little passion for Abdullah or the election process in general, with most of them abstaining from voting in last year's lacklustre and personality-driven election that saw candidates pitch few new ideas.
"The fraudsters are the shame of history and we announce our inclusive government," Abdullah said, also calling the results a "coup against democracy".
The Taliban also rejected Ghani's win, calling it "illegal" and "against the peace process".
Earlier, Ghani had hailed the results, saying in televised comments that "our government, our arms are open to all the people of Afghanistan".
- 'Many options' -
Election commission chief Hawa Alam Nuristani said Ghani had taken 50.64 percent of the votes, compared to Abdullah's 39.52 percent.
"May God help him in serving the people of Afghanistan... I also pray that peace comes to our country," she added at a press conference earlier Tuesday in the capital Kabul.
The final results come just as Washington 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.
An Afghan official said the two foes could sign the deal February 29 in Doha, depending on how well a confidence-building "reduction in violence" period plays out.
US President Donald Trump has repeatedly expressed a wish to get troops home from America's longest war.
His peace envoy, Zalmay Khalilzad, said Monday that he was "cautiously optimistic" about progress toward an eventual deal, adding that the United States has "commitments from the Talibs on security issues".
Once the deal is reached the Afghan government would have to prepare to meet the Taliban and negotiate a formal peace agreement on behalf of the Afghan people.
Political analyst Atta Noori called the results "a step forward towards the possible talks with the Taliban".
"A shaky government was in no position to talk with the Taliban. Now is the time for Ghani to act as a statesman and form an inclusive team to talk with the Taliban," he told AFP, adding that people from Abdullah's camp should be among the negotiators.
As for Abdullah's next steps, Noori said the talks were "more important" than fraud allegations.
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.
Voters stayed away from polls en masse amid threats of Taliban violence and cynicism that any politician in a country beset with nepotism and corruption could really chart a new course for ordinary Afghans.