Walking away from a war is not a strategy. But an orderly withdrawal of NATO forces can be organized and executed before the year is out and more lives are lost to a lost cause. Two Americans have been killed in combat already in 2019. No American soldiers should be fighting and dying in Afghanistan in 2020.

Recent talks between the United States and the Taliban appear to have made encouraging progress. Those talks might be most accurately described as a negotiated capitulation by the international forces. The Afghan government hasn’t been party to the discussions because the Taliban doesn’t consider it a legitimate entity — just a puppet of the United States. In any case, once NATO forces leave, any treaty with the Taliban would be difficult to enforce.

But as part of any withdrawal discussions, it should be made clear to the Taliban, the Afghan government and neighboring nations that if the country is allowed to again become a base for international terrorism, the United States will return to eradicate that threat. The Taliban have paid a very high price for harboring Bin Laden and — whatever their role in the future of the country — are unlikely to trigger a return of American forces by making a similar mistake in the future.

The eventual withdrawal of American forces might be the only thing that all the parties to the conflict want to see happen. A majority of Americans want an end to the war. If Mr. Trump doesn’t end the war by the end of the year, Congress can repeal the 2001 authorization of military force. Congress needs, in any event, to reconsider its blank check.

Congress should also make it easier for Afghans who worked with NATO forces and want to immigrate to the United States to do so. Many have already been waiting for years.

No one can pretend that a withdrawal, even with an agreement, is likely to make life better for the Afghan people in the short term. That’s an agonizing consequence that anyone who supports withdrawal must acknowledge. Some experts predict an even fiercer civil war as the Kabul government and its army weaken and warlords gain new power. That could mean more deaths, new refugee flows and cuts in international aid that could cripple the Afghan military .

The plight of women and girls in Afghanistan has been perilous in wartime, and it could become far bleaker if the Taliban topple the current government and reimpose their barbaric pre-2001 regime.