KABUL, Afghanistan — U.S. and Taliban officials have moved closer to an agreement that could meet a Taliban demand for withdrawing U.S. troops from Afghanistan, officials here indicated Monday, a potential step toward ending decades of continuous conflict.

Afghan President Ashraf Ghani, speaking from his palace in Kabul, addressed what appeared to be a significant breakthrough in talks between American officials and Taliban representatives in Doha, Qatar, calling on insurgents to begin “serious talks” with his government and embrace a “speedy peace.”

The tentative agreement for a framework to pull out U.S. troops, in exchange for Taliban promises to deny al-Qaida and the Islamic State a foothold on Afghan soil, comes as Washington races to clinch a deal just weeks after President Trump ordered the withdrawal of up to half of the 14,000 American troops in the country.

But both U.S. and Afghan officials said several major issues remain to be resolved before a peace agreement can be reached, including U.S. demands for an extended cease-fire and the Afghan government’s insistence on being included in talks about the Taliban’s future role in government and society.

Strong support across the U.S. government for a political solution reflects a recognition of the elusiveness of a military victory against a militant group that has defied almost two decades of warfare with U.S. and NATO forces.

It also reflects the toll that a war that began in the wake of the Sept. 11, 2001, attacks has taken on Afghanistan’s people, government and economy.

During six days of talks in Qatar last week, Taliban and U.S. representatives outlined but did not formally agree on a broad plan in which U.S. troops would leave the country in exchange for the insurgents pledging to ensure that Afghan territory would not be used by them or other Islamist militant groups to harm American interests.

Significant obstacles remain to reaching a peace deal, though – or even beginning substantive talks.

“This is a major breakthrough. It’s the closest we’ve ever been to ending this 18-year war. But a framework shouldn’t be mistaken for a deal. There is still a lot to flesh out,” said Michael Kugelman, deputy director of the Asia program at the Wilson Center. “Above all, the Afghan government needs to be brought into these discussions. And even with all this momentum, a fundamental challenge will remain in place: How to ensure that the Taliban holds up its end of the bargain and doesn’t take up arms again, in the event of a deal.”

The Pentagon hasn’t adjusted its plans to continue aiding Afghan national forces fighting the Taliban.