The Obama administration kept up pressure on the squabbling political rivals vying to be Afghanistan’s next leader, dispatching Secretary of State John F. Kerry to Kabul on Thursday as an audit of disputed presidential election results ground on.

Kerry is seeking a commitment from the two top vote-getters that they will comply with the audit and abide by the results, while warning that the slow-moving and contentious review must not be further delayed. A successful transfer of presidential power in Afghanistan this year is a cornerstone of the U.S. plan to withdraw combat forces and end a war that has dragged on for nearly 13 years.

The United States is endorsing an ambitious Afghan government schedule to complete the audit within 20 days, clearing the way for a new president to be inaugurated ahead of a NATO summit in Britain in September.

Both candidates — former finance minister Ashraf Ghani and former foreign minister Abdullah Abdullah — contend they won a runoff vote in June. Allegations of widespread fraud on behalf of Ghani, a former World Bank official, brought the election process to the brink of fracture. Abdullah had finished ahead of Ghani in a first round of voting in April but failed to attain a majority, necessitating the runoff.

Kerry brokered an emergency compromise last month that included the audit and a broad power-sharing agreement, but the public feuding has continued.

Kerry’s unannounced visit Thursday comes two days after Army Maj. Gen. Harold J. Greene was killed in what appeared to be the latest in a string of “insider” attacks by Afghan soldiers and police on the international forces fighting and training alongside them.

“The secretary will encourage both candidates to work together in the spirit of collegiality and statesmanship, to ensure national unity and the means to build on the progress the Afghan people have achieved,” State Department spokeswoman Jen Psaki said.

Kerry held back-to-back meetings with each candidate Thursday night, as well as with the United Nations representative assisting the Afghan authorities overseeing the vote audit.

Posing for a photo with Ghani at the U.S. Embassy, Kerry made small talk about the recent end of the holy month of Ramadan, during which Muslims fast from sunrise to sunset. The annual period of fasting and reflection coincided with the beginning of the vote review.

“On Ramadan, tempers go up,” Ghani remarked.

Reporters heard none of the substance of their discussion.

Mahmad Saiqol, a spokesman for Abdullah, said Thursday night, “We hope that these meetings will lead to the signing of the original political framework we agreed to with Mr. Kerry and the formation of a joint committee to refine and work out the details.”

A senior U.S. official traveling with Kerry said the goal is to encourage recent signs of cooperation between the candidates and nudge the review process along. U.S. and NATO military help for Afghanistan and the likelihood of continued international financial aid may hinge on a quick resolution of the election dispute.

“It’s really an issue of political will,” said the senior official, who spoke on the condition of anonymity to preview Kerry’s argument. “Both sides have to engage in it in good faith. They have to move through the process fairly quickly.”

The United States wants both sides to commit to a timeline for completing the audit of more than 8 million ballots. Washington is waiting on a declared winner to sign an agreement governing how a small training and advisory force would operate after the bulk of U.S. troops depart by the end of the year.

Afghan President Hamid Karzai refused to sign the pact, leaving it to his successor. The Obama administration has said it will not allow any forces to remain without the deal in place. An agreement governing NATO forces is similarly in limbo.

Both Abdullah and Ghani have said that they would sign the agreements as president.

The power-sharing plan envisions that the declared audit winner would become president and the runner-up a chief executive.

U.S. and U.N. officials are worried that the two men will fail to achieve a viable power-sharing arrangement, further protracting the country’s political vacuum, rendering the audit result meaningless and jeopardizing international aid and cooperation.

International impatience to resolve the vote dispute is growing. A new president had been scheduled to assume office last weekend. The NATO summit Sept. 4-5 was viewed as a transition point, as the current military mission ends and donor nations look to a new leader amid wide frustration with Karzai.

“That’s important for Afghanistan’s political stability,” the senior official said. “It’s important for a new president to be able to go to NATO and ask for these commitments,” including continued financial support for the Afghan National Security Forces.

“That is still the goal, and we are all doing everything possible to ensure that it can stay the goal. I don’t think any of us want to set a specific deadline or look to kind of contingency planning at this point,” the official said.

Kerry’s visit comes just three weeks after he made a dramatic trip to Kabul as the Afghan election process was rapidly collapsing amid accusations of fraud.

Kerry brokered an eleventh-hour deal in which both campaigns agreed to a full recount of the ballots cast in the runoff. They also pledged to form a government of national unity but have since argued over what that means.

Abdullah, the more likely loser, has demanded the right to name cabinet ministers and governors from his powerful base; Ghani, the more likely winner with a 1.5 million-vote lead before the audit, has said that he will offer the loser an “inclusive” role, meaning he can make recommendations but not wield real power.

Neither man wants to concede the election or start negotiating the details of a power-sharing arrangement until the audit is far enough along to make it clear which one will be the winner.

Karzai has said that the audit will probably be complete and a new president named by the end of August. But other international diplomats predict that the review could stretch for many more weeks or months.

The agreement Kerry brokered in July has nearly fallen apart over numerous points of contention. The audit has been stalled several times by disputes over how to determine which votes are invalid, and aides to Abdullah have condemned it as a sham.

The count finally resumed this week but has been plagued by shouting matches and fistfights between observers from both camps watching the audit in secured warehouses.

Despite the difficulties, the U.S. official said the process is running more smoothly now.

“It took a long time to get here, but over the last few days it has gone much better,” the official said.