WASHINGTON — President Trump’s headway in Afghan peace negotiations with the Taliban raises the same question that has bedeviled other presidents who extracted American troops from foreign wars: Will the departing Americans end up handing over the country to the same ruthless militants that the United States went to war to dislodge?

A hasty American withdrawal, experts said, would erode the authority and legitimacy of the Afghan government, raising the risk that the Taliban could recapture control of the country. Short of that, it could consign Afghanistan to a protracted, bloody civil war, with Taliban fighters besieging the capital, Kabul, as they did in the 1990s.

These scenarios now seem possible because of the progress in direct talks between the United States and the Taliban. The chief American negotiator, Zalmay Khalilzad, said Monday that American and Taliban officials had agreed in principle to the outlines of a deal in which the insurgents would guarantee that Afghan territory is never used by terrorists, setting the stage for a total pullout of American troops.

[Afghans fear that the country’s interests have been sidelined in U.S. talks with the Taliban.]

While current and former American diplomats and military officials voiced cautious optimism about the negotiations, they questioned whether the Taliban and the administration in Kabul would ever agree to a power-sharing arrangement, given that the Taliban still refuse even to speak to the government of President Ashraf Ghani. Some fear that the Taliban will seek to overthrow the government once the Americans are gone.