Sometimes, foreign policy consists of trying to make lemonade out of lemons.

In the case of the recently signed U.S.-Taliban agreement on Afghanistan, President Trump provided the lemons, and the lead U.S. negotiator, Zalmay Khalilzad, and his team did the squeezing. Mr. Trump made clear that he intended to withdraw American forces from Afghanistan — with or without a “deal.” Then NATO partners pressured the United States not to reward the Taliban by conceding their long-held objective of forcing an American withdrawal for free. So, the president reportedly gave his negotiators a finite window to explore whether some deal was achievable.

Lacking the backing of a resolute American commander in chief, Mr. Khalilzad got what he could — a deeply flawed agreement that has the potential to lead to peace but is very unlikely to achieve it. In short, the United States gave away a lot and got relatively little in return.

To start, the United States dropped its longstanding, principled opposition to negotiating directly with the Taliban (including the terrorist Haqqani network, which has killed countless American service members) without our key partner, the Afghan government, at the table. Next, following a seven-day, roughly 80 percent “reduction in violence,” the United States acceded to the Taliban’s primary demand — that America fully withdraw all of its own and NATO forces as well as intelligence personnel from Afghanistan.

Mr. Trump agreed to draw down from our current force level of approximately 12,000 U.S. troops to 8,600 (the level he inherited from President Barack Obama) within four and a half months. Within 14 months, he will drop American and NATO troops to zero — leaving only an embassy-based diplomatic presence.