In the middle of this knot is Zalmay Khalilzad, the American envoy who is leading the peace efforts. Having joined a ninth round of talks with the Taliban in Doha, Qatar, presumably putting the final touches on a deal, Mr. Khalilzad was expected in Kabul as soon as Thursday evening to brief the Afghan leadership before he returns to Doha to announce the agreement with the Taliban, officials said.

The American-Taliban deal is to include a schedule for the withdrawal of the remaining American and NATO troops in the country, who number more than 20,000 all together. In return, the Taliban would provide assurances that it would not support international terrorist groups, so that Afghan soil would not be used for attacks against the West, and they would open direct talks with Afghan officials.

American and Western officials say they have prepared for an immediate start to direct talks between the Taliban and other Afghans, including the government, once the withdrawal schedule is announced. Some of the officials suggest their hope is that momentum in the talks will result in the elections being delayed.

Mr. Ghani’s concerns are deeply rooted in history, when the withdrawal of the Soviet Union resulted in the Afghan state collapsing into anarchy. Mr. Ghani is cautioning against a rushed process that could bring about a repeat of that chaos.

One Afghan official described the moment this way: the Americans are managing a withdrawal, the Taliban a victory. In all this, Mr. Ghani is trying to respond to a heavy blow in a way that protects him and the system as much as possible.

Mr. Ghani has said that fresh elections would give a mandate to the new government, which could then negotiate with the Taliban from a stronger position. But others fear that going into elections when the past two votes have been disputed, with little done since to restore trust in the electoral process, risks a dispute that could eat up a great deal of time.