Afghan election commission workers display ballot papers during an audit of the presidential runoff vote in the country's general election at a counting center in Kabul. (Shah Marai/Agence France-Presse via Getty Images)

With a crucial deadline soon approaching to inaugurate a new president and an election ballot recount in a critical stage, fears are growing that Afghanistan’s fragile transition process could collapse into violence.

The quickening pace of a protracted election audit and a flurry of meetings between aides to the two rival candidates this week have raised faint hopes that the country may have a new leader in office within the next two weeks, just in time to attend a NATO summit crucial to future foreign aid for Afghanistan.

But Afghan and international observers here warn that the process could easily fall apart, with disputes persisting over the fairness of the ballot recount and the two candidates unable to agree on a division of power after a winner is declared. Under U.S. pressure, they agreed to form a national unity government with a president as well as a chief executive, but they differ strongly on the details.

Despite pleas for patience from international officials, aides and allies of Abdullah Abdullah — the candidate who originally called for the ballot recount and charged massive fraud in a June runoff vote against rival Ashraf Ghani — continue to threaten that they will pull out of the process and call for civil unrest if Ghani wins a tainted recount and is named president.

One powerful governor backing Abdullah threatened in June to form a “parallel government” after Abdullah lost the runoff, and last week he again called for a “civil uprising” and takeover of the capital if Abdullah loses the vote recount. There have been separate news reports that some officials close to the Afghan security services may be planning to install their own “interim government” if the political process falls apart.

In the past several days, police and security vehicles have flooded the capital and sporadic gunfire has been heard. On Tuesday, a knife fight reportedly broke out at the heavily guarded election compound where the votes are being recounted, injuring several people.

Although both candidates have signed a commitment to form a joint government as soon as the recount results declare one of them president, negotiating teams for Ghani and Abdullah are apparently still miles apart on how much power and authority the loser would be able to exercise as chief executive — a critical factor in dispensing patronage to powerful backers and allies.

Uncertainty over what will happen in the next two weeks — whether Afghanistan will manage to install a new government or face violent challenges from forces unwilling to accept electoral defeat — is gripping a nation that has gambled its future on a deeply flawed first democratic transition of power.

“Afghanistan is very fragile and unstable. We are right at the edge of making or destroying all the hopes that the people have for new leadership and a credible government,” said Abbas Noyan, a spokesman for Ghani. “Former adversaries need to become partners, but we have enemies on all sides, from the hardliners to the Taliban. If violence starts, a lot of people will be killed before it can be stopped.”

Ghani, a former World Bank official, won the June runoff by a wide margin over Abdullah, a former foreign minister, and is likely to prevail in the recount. Abdullah, who got the most votes among 16 candidates in a first round in April, has alleged that both the runoff and the recount have been fraudulently stacked against him by Ghani and the outgoing government of President Hamid Karzai.

The deadline to install a new president by month’s end is more symbolic than legal, since the original inauguration date slipped by several weeks ago. But with a NATO summit early next month and a much-delayed U.S.-Afghan security agreement awaiting a new president’s signature, the future of Western economic and military support for Afghanistan hangs in the balance.

Karzai, who has led Afghanistan for more than a decade since the overthrow of the Taliban regime, says he intends to leave office by the end of the month, raising the prospect of a prolonged power vacuum if no one is confirmed to replace him. NATO leaders have said they will have to start plans to withdraw all forces from Afghanistan if the security agreement is not signed soon.

Until recently, the ambitious, U.N.-supervised audit had been slowed by technical problems and constant disagreements between the two sides. In the past week it has picked up considerable speed, but it is about to enter a new, highly politicized phase. Election officials plan to announce partial results, which could unleash a frenzy of accusations and ultimatums from both camps.

This week, aides to Abdullah echoed the earlier warning by Gov. Attah Mohammed Noor, who threatened that a mass of unarmed protesters would occupy the capital to prevent a new government from entering power if Abdullah lost the recount through fraud.

“We hope and believe that the audit will be fair and transparent, but we know that invisible fraud is taking place,” Fazel Rahman Horia, a spokesman for Abdullah, said Monday. “If the outcome is not legitimate and does not represent the voters, we will guard the people’s vote and we will not let any illegitimate president enter the palace or any illegitimate ministers enter the ministries.”

The threats may be part of Abdullah’s negotiating strategy, but the danger, observers said, is that the obstructionist mood could take on a life of its own, even without Abdullah’s imprimatur.

The concern is that Afghanistan’s long history of ethnic conflict will reemerge if the electoral process fails. Ghani, a Pashtun, enjoys strong support among the dominant Pashtun populace based in the south. Abdullah, although half-Pashtun by birth, is strongly identified with the Tajiks and other northern ethnic groups.

Already, the departure of thousands of civilian foreign aid workers, as well as well-to-do Afghans anticipating the worst, is visible across the capital. Dozens of houses in affluent neighborhoods have “For Rent” signs on the door. Banks, restaurants and shops once frequented by foreigners are empty. Rows of idle cranes and other heavy equipment sit rusting in once-bustling construction yards.

“This is the first time in Afghanistan’s history that we are trying to have an election that is not winner-take-all,” Noyan said. “What we need is to build a democracy based on merit instead of plunder, where institutions and law are respected. If we fail, 13 years of international effort will end, and we will have to go back to kindergarten.”