MILLIONS OF Afghans bravely trooped to the polls last month for the second time this year to vote in a presidential election. The country’s U.S.-trained security forces did a creditable job holding off attacks by the Taliban, as they have ever since they took over full responsibility for combat operations. Yet an all-too-familiar cast of politicians now threatens to nullify those achievements as they feud over the vote count and allegations of fraud. Already juggling international crises in the Middle East and Ukraine, the Obama administration and its NATO allies may need to act quickly this week to prevent political chaos in Kabul.

The accelerant for what so far has been a simmering but peaceful dispute could be the scheduled announcement Wednesday of preliminary election results by the Independent Election Commission. Oddly, the candidates in the June 14 runoff, Abdullah Abdullah and Ashraf Ghani, agree on the likely result: an advantage of 1 million or more votes for Mr. Ghani. But Mr. Abdullah, who won 45 percent of the vote to Mr. Ghani’s 32 percent in the April first round, is charging that electoral officials inflated Mr. Ghani’s total with 1 million or more illicit votes stuffed into ballot boxes in turbulent eastern and southern provinces.

Though unproven, Mr. Abdullah’s charges are not insubstantial. He cites an unlikely tripling of turnout in provinces such as Khost, where the Pashtun ethnic group is dominant. He has also released audio recordings in which men he identifies as election officials are heard discussing “stuffing the sheep.” Mr. Ghani is a Pashtun, as is President Hamid Karzai; Mr. Abdullah, who is of mixed heritage, charges that Mr. Karzai orchestrated the fraud, as he allegedly did when Mr. Abdullah challenged him in the 2009 election.

Though he eventually stepped aside for Mr. Karzai, Mr. Abdullah appears determined to press his case against Mr. Ghani. On Friday he mobilized thousands of supporters in Kabul and other cities, and on Sunday he announced that he would not accept the decisions of the election commission. The top election official resigned last week following Mr. Abdullah’s release of the audio recordings. But the commission rejected Mr. Abdullah’s proposals for identifying tainted ballots, and Mr. Ghani’s campaign has taken the position that fraud charges should be adjudicated by the official electoral complaints commission, whose members were appointed by Mr. Karzai.

U.N. officials have been trying to mediate the dispute, as has a State Department envoy. But a more forceful and high-profile intervention may be needed. The Afghan parties don’t appear inclined to compromise, and the danger is growing that the country will split along ethnic and geographical lines, as it did during the civil wars of the 1980s and 1990s. For NATO, the successful inauguration of a new president next month is essential to plans to complete a troop withdrawal this year while leaving a residual force for training and counterterrorism. Western officials cannot adjudicate the election result, but they can insist on a credible process for auditing the vote count and investigating claims of fraud.

Supporters of Afghanistan's presidential candidate Abdullah Abdullah chant slogans during a protest against election fraud in Kabul, Afghanistan, Friday, June 27, 2014. (Massoud Hossaini/AP)