In a statement, the election commission said Mr. Ghani was leading with 50.64 percent of the votes over his main challenger, Abdullah Abdullah, with 39.5. Although the announcement was not final and the outcome could still take months to finalize, Mr. Abdullah’s team has already warned that it will not accept the results until its concerns are answered about more than 15 percent of the total votes.
The announcement brings a messy political crisis — which has bogged down the country for nearly three months amid a raging war and peace negotiations with the Taliban — to a potentially dangerous showdown.
Weeks before the announcement, Mr. Abdullah’s supporters blocked nearly a dozen election offices across the country, with protesters holding sit-ins and preventing election workers from carrying out a vote audit. Regional leaders allied with Mr. Abdullah have threatened the takeover of provinces.
“No results, whether preliminary or initial or final, that is filled with fraud — we will not accept it,” Mr. Abdullah said recently. “No one should dream of ruling again with fraudulent votes, like 2014.”
A similar election dispute between Mr. Abdullah and Mr. Ghani in 2014 went to a messy stalemate that was resolved through a power-sharing government brokered by John Kerry, then secretary of state. That arrangement made Mr. Ghani president and Mr. Abdullah the government’s chief executive. This time around, with American diplomacy focused on negotiating an end to the war with the Taliban, American officials and other Western allies have made clear they will not step in to mediate.
Mr. Abdullah disputes about 300,000 votes as lacking transparency and potentially helping Mr. Ghani. Among them are 100,000 ballots registered in the system either before or after voting hours — in some cases by weeks or months. The election commission attributes the irregularities to human error in setting the time and date of devices that recorded the votes.
Last week, as expectations were rife that the election commission would announce initial results, Mr. Abdullah made a concession by calling his supporters to allow the audit of the seven provinces they were blocking. He described it as a good-will gesture to get the commission to reconsider its decision on the nearly 300,000 questionable votes. But the election commission has not budged on that demand.
The election commission, particularly its chief Hawa Alam Nuristani, has been under tremendous pressure to announce the results. During a recent argument in a commission meeting, she broke down and wept, according to three officials. Last week, nearly six hours of televised debate with candidate representatives turned into heated quarrels and ended with no resolution. At one point, Ms. Nuristani got into an argument with the representative of one opposition candidate and walked out.
“I am independent,” Ms. Nuristani said, thumping her chest as she left the room. “I have held the elections; I will announce the results.”
She returned to her seat later. Her usual calm restored, she took to the podium and explained that it was not the criticism that had angered her, but repeated — and often sexist — insults. Her emotional words were a telling indicator of the stress placed on Afghanistan by the election’s uncertain outcome. Her predecessor and most of the previous commissioners are in prison on charges of abusing the parliamentary vote last year.
“I am not a traitor,” she declared, saying that she had led the process according to the law. “I am committed to my people; I don’t want to do something that takes me to prison, I want to go work honestly and go home.”
Fatima Faizi contributed reporting.