Eighteen years ago, after hijacked planes dive-bombed into the World Trade Center and the Pentagon, it would have been considered delusional to imagine an American President sitting down with the jihadis tied to the deadliest terrorist attack on U.S. soil—and at the historic Camp David, no less. But it almost happened over the weekend, and may still. “Unbeknownst to almost everyone, the major Taliban leaders and, separately, the President of Afghanistan, were going to secretly meet with me at Camp David on Sunday,” President Trump revealed on Twitter, on Saturday night. He both revealed and cancelled the summit in a furious series of tweets.

On the anniversary of 9/11, the United States is increasingly impatient, even desperate, to end the military offensive launched, in 2001, to oust the Taliban government from Afghanistan and eliminate the Al Qaeda terrorists it harbored. America’s longest war has, in the end, failed to expel the Taliban. The group now controls or contests more territory—forty-six per cent of the land, inhabited by a third of the population—than at any time since the U.S. intervention. (This spring, the Pentagon stopped assessing who holds what, which has long been a key barometer of U.S. success.) Today, any deal to withdraw U.S. troops will be premised on recognition that the Taliban have the right to a role in ruling Afghanistan.

All told, twenty-four hundred American service members have died in Afghanistan, another thousand NATO allies have been killed, and twenty thousand have been wounded. Since 2009, more than thirty-thousand Afghan civilians have been killed and fifty-six thousand have been wounded, most in insurgent attacks. In a startling shift that has occurred under the Trump Administration, the U.S. and its allies in Afghanistan have been linked to more civilian deaths than the Taliban this year.

Diplomacy has wide support, for disparate reasons but one common truth. “Let’s not lose sight of the fact that after eighteen years of trying, it’s clear that a military defeat of the Taliban by U.S. and Afghan security forces is not a realistic option,” Andrew Wilder, an Afghanistan expert and the vice-president of the U.S. Institute of Peace’s Asia programs, told me.

Yet Trump’s race to wrap up what he called an “aimless boondoggle” in Afghanistan has also led to uncertainty about whether U.S. policy now is tied to engaging the Taliban, or whether he will order a unilateral U.S. withdrawal if talks don’t resume. “As far as I’m concerned, they are dead,” he told reporters, on Monday, en route to a political rally in North Carolina. To keep a campaign pledge, before he faces a reëlection test, the President could simply recall the fourteen thousand troops in Afghanistan. That risks even bigger dangers, Wilder warned. A precipitous withdrawal would limit U.S. leverage and “seriously weaken” the Afghan government and security forces. “I could easily see a return to the anarchy and civil war of the nineteen-nineties that gave birth to the Taliban in the first place, and ultimately to safe havens for terrorists to attack the U.S.”

The Administration had identified a four-part peace plan to prevent the disintegration of Afghanistan into another terrorist haven. One is a U.S. troop withdrawal. The second is a Taliban commitment to insure that no terrorist attacks against the United States are conducted on Afghan soil. The third is a ceasefire among all warring parties. The final piece is an intra-Afghan dialogue, to be hosted in Oslo by the Norwegian government, to negotiate a political settlement that includes the government, the Taliban, civil society, and other key players—and then formally end the war.

After almost a year of diplomacy, Special Envoy Zalmay Khalilzad brokered an agreement on the first two steps. Last week, after the latest round of talks in Qatar, Khalilzad called the deal “imminent.” The terms reportedly include an initial withdrawal of five thousand U.S. troops—of the fourteen thousand based there—in the next five months. The Taliban, in turn, would take steps to prevent terrorist plots against the United States emanating from Afghanistan. The remaining U.S. troops would be pulled out within roughly sixteen months.

“In principle, on paper, yes, we have reached an agreement—that it is done,” Khalilzad, who was born in Mazar-e Sharif, educated in the United States, and later served as U.S. Ambassador to Afghanistan, told an Afghan television station. “But it is not final until the President of the United States also agrees to it.”

There were still glitches—over process and substance as well as peace itself. The biggest issue is a ceasefire, the premise for enduring peace. For all the language invoked by both the Trump Administration and the Taliban, that’s more than they have been negotiating. “The story for months now has been that we are negotiating only with the Taliban. We are not laying out the demands for a complete ceasefire,” which would involve all the warring parties, Ryan Crocker, the former U.S. Ambassador to Afghanistan, told me.

“In no way, in any real world, can you imagine an event at Camp David ending with something that you would credibly call a peace process,” Laurel Miller, a former Afghan expert at the State Department who is now the Asia Program director of the International Crisis Group, said. “It’s not an Afghanistan version of the Middle East peace process at Camp David. It’s an exchange of commitments,” one that might open up space for a process among Afghans, hosted by another nation—without the United States in the thick of it.

As originally designed, Trump was planning to host separate meetings at Camp David with the Taliban and the Afghan President Ashraf Ghani, whom the Taliban has refused to negotiate with until it reaches an agreement on the withdrawal of U.S. forces. Members of the Taliban were reportedly concerned that they would be tricked into official talks with Ghani. They also feared that Trump would press them to accept a ceasefire, which the militants have refused to do until they have a political deal that includes them. These third and fourth parts were designed to be negotiated in Oslo after implementation of the U.S.-Taliban agreement.

Trump blamed the cancellation of his secret summit talks on a Taliban bombing that killed an American soldier and eleven others in Kabul last week—or so the President claimed, to widespread skepticism. The militants “killed one of our great great soldiers,” Trump tweeted. On Saturday night, he dispatched Secretary of State Mike Pompeo to Dover Air Force Base, in Delaware, to greet the coffin of Sergeant First Class Elis Angel Barreto Ortiz, a paratrooper from Puerto Rico killed during his second stint in Afghanistan.

“If they cannot agree to a ceasefire during these very important peace talks, and would even kill 12 innocent people, then they probably don’t have the power to negotiate a meaningful agreement anyway,” the President tweeted. “How many more decades are they willing to fight?”

Barreto’s death may have served as a face-saving excuse. Fifteen other Americans have been killed this year, during nine rounds of the most serious diplomacy between the U.S. and the Taliban since 2001. Both sides have used military pressure as leverage in the final run-up to a deal—and both sides expected it. In the previous ten days, the United States had killed more than a thousand Taliban, Pompeo boasted on a round of Sunday talk shows.