WASHINGTON — On the Friday before Labor Day, President Trump gathered top advisers in the Situation Room to consider what could be among the profound decisions of his presidency — a peace plan with the Taliban after 18 years of grinding, bloody war in Afghanistan.
The meeting brought to a head a bristling conflict dividing his foreign policy team for months, pitting Secretary of State Mike Pompeo against John R. Bolton, the national security adviser, in a battle for the competing instincts of a president who relishes tough talk but promised to wind down America’s endless wars.
As they discussed terms of the agreement, Mr. Pompeo and his negotiator, Zalmay Khalilzad, made the case that it would enable Mr. Trump to begin withdrawing troops while securing a commitment from the Taliban not to shelter terrorists. Mr. Bolton, beaming in by video from Warsaw, where he was visiting, argued that Mr. Trump could keep his campaign pledge to draw down forces without getting in bed with killers swathed in American blood.
Mr. Trump made no decision on the spot, but at some point during the meeting the idea was floated to finalize the negotiations in Washington, a prospect that appealed to the president’s penchant for dramatic spectacle. Mr. Trump suggested that he would even invite President Ashraf Ghani of Afghanistan, whose government has not been party to the talks, and get him to sign on.
In the days that followed, Mr. Trump embraced an even more remarkable idea — he would not only bring the Taliban to Washington, but to Camp David, the crown jewel of the American presidency. The leaders of a rugged militant organization deemed terrorists by the United States would be hosted in the mountain getaway used for presidents, prime ministers and kings just three days before the anniversary of the Sept. 11, 2001, attacks that led to the Afghan war.
Thus began an extraordinary few days of ad hoc diplomatic wrangling that upended the talks in a weekend Twitter storm. On display were all of the characteristic traits of the Trump presidency — the yearning ambition for the grand prize, the endless quest to achieve what no other president has achieved, the willingness to defy convention, the volatile mood swings and the tribal infighting.
What would have been one of the biggest headline-grabbing moments of his tenure was put together on the spur of the moment and then canceled on the spur of the moment. The usual National Security Council process was dispensed with; only a small circle of advisers was even clued in.
And even after it fell apart, Mr. Trump took it upon himself to disclose the secret machinations in a string of Saturday night Twitter messages that surprised not only many national security officials across the government but even some of the few who were part of the deliberations.
Almost a Done Deal
For Mr. Trump, ending the war in Afghanistan has been a focus since taking office, a signature accomplishment that could help him win re-election next year. For nearly a year, Mr. Khalilzad, a former ambassador to Afghanistan, has engaged in talks with the Taliban to make that happen.
In recent weeks, it had been increasingly clear that the United States and the Taliban, after nine rounds of painstaking negotiations in Doha, Qatar, had ironed out most of the issues between them. Mr. Khalilzad declared that the agreement document had been finalized “in principle.”
The deal called for a gradual withdrawal of the remaining 14,000 American troops over 16 months, with about 5,000 of them leaving within 135 days. In return, the Taliban would provide counterterrorism assurances to ease American fears of a repeat of Sept. 11 from Afghan soil.
But the negotiations left out Afghanistan’s government, and Mr. Ghani’s officials criticized it for lacking measures that would ensure stability. At home, Mr. Trump was cautioned by Senator Lindsey Graham, Republican of South Carolina; Gen. Jack Keane, a retired Army vice chief of staff; and Gen. David Petraeus, the retired Afghanistan and Iraq commander.
Mr. Bolton was the leading voice against the deal on the inside as Mr. Pompeo’s allies increasingly tried to isolate the national security adviser. Mr. Bolton argued that Mr. Trump could pull out 5,000 troops while still leaving enough forces to assist counterterrorism efforts without a deal with the Taliban, a group he argued could not be trusted.
In an interview on Sunday, Mr. Graham said he shared Mr. Trump’s desire “to end the war in Afghanistan between the Taliban and the Afghan people.” But he added that no deal could include withdrawing all American forces or trusting the Taliban to confront Al Qaeda or the Islamic State.
“My advice to the administration is, let’s focus on trying to shore up our relationship with Pakistan,” he said, adding that it should include a free-trade agreement. He said that the Taliban must be prevented from believing it can seek safe harbor in Pakistan.
A Dividing Point
When Mr. Khalilzad left Doha after the last round of talks concluded on Sept. 1, two days after the Situation Room meeting, he and his Taliban counterparts had finalized the text of the agreement, according to people involved. Leaders of both teams initialed their copies and handed them to their Qatari hosts.
Before the end of the meeting, Mr. Khalilzad brought up the idea of a Taliban trip to Washington. Taliban leaders said they accepted the idea — as long as the visit came after the deal was announced.
That would become a fundamental dividing point contributing to the collapse of the talks. Mr. Trump did not want the Camp David meeting to be a celebration of the deal; after staying out of the details of what has been a delicate effort in a complicated region, Mr. Trump suddenly wanted to be the dealmaker who would put the final parts together himself, or at least be perceived to be.
The idea was for Mr. Trump to hold separate meetings at Camp David with the Taliban and with Mr. Ghani, leading to a more global resolution.
Even as talks were wrapping up in Doha, the American ambassador to Afghanistan arrived at the presidential palace in Kabul with the proposal of a Camp David meeting, Afghan officials said.
Details were sorted out between the Afghan president and the American side when Mr. Khalilzad arrived from Doha and held four rounds of talks with Mr. Ghani. A plane would arrive to take Mr. Ghani and his delegation to the United States, according to the initial plan.
Mr. Ghani’s ministers knew that a Taliban delegation would most likely be arriving, too, but were unclear on the details. They had three priorities: the fate of presidential elections scheduled for Sept. 28, how the peace talks would move forward to include them and how they would bolster security forces to reduce the cost for the United States.
As a sign of how important the event was for the United States, Mr. Ghani got the Americans to agree to include on the trip his national security adviser, Hamdullah Mohib, who had essentially been kept out of the American meetings after lashing out at the peace process.
For months, the Americans had essentially held Mr. Ghani’s re-election campaign hostage to a deal that they projected was imminent. Mr. Ghani was reduced to pretending that the September elections were still on by holding a couple of daily “virtual rallies” at which he addressed small gatherings around the country via video chat. If the American-Taliban deal were finalized, it would most likely push the elections back.
If Mr. Ghani had refused the Camp David meeting, he would have been called a spoiler of peace, a senior Afghan official said. So he took his chances; it was to be hosted by an ally on friendly turf, and it could help clarify whether there would be a peace deal, and whether the elections would proceed.
But Taliban leaders, having refused to negotiate directly with the Afghan government until after the group had an agreement with the United States, said the Americans were tricking them into political suicide.
A senior Taliban leader said on Sunday that Mr. Trump was fooling himself to think he could bring the Taliban and Mr. Ghani together at Camp David “because we do not recognize the stooge government” in Kabul.
The Americans were also rushing to finalize outstanding issues in the days before the last-minute proposed Camp David meeting. Among the most significant was a disagreement over the release of thousands of Taliban prisoners in Afghan prisons.
Afghan officials said the Americans had taken the liberty of negotiating on their behalf by agreeing to the release. Mr. Ghani’s government found that unacceptable, saying it would agree only if the Taliban reciprocated with an extensive cease-fire — something the insurgents are reluctant to do at this stage of the talks since violence is their main leverage.
The final negotiations occurred during a period of intensifying bloodshed. In response to Taliban attacks, American negotiators made clear they were prioritizing the agreement, not looking to boycott the talks. Their negotiations were undergirded by increasing battlefield pressure by the American military.
When Mr. Khalilzad and Gen. Austin S. Miller, the American commander in Afghanistan, returned to Doha on Thursday, it was to finalize technical appendices to the main text. The Taliban negotiators got no sense that anything was amiss and later posted on Twitter that the atmosphere was good.
But the same day, aides told Mr. Trump about a suicide car bomb attack that killed an American soldier and 11 others. At this point, according to senior officials, Mr. Trump and his team were unified. He could not host Taliban leaders at Camp David just days after an American was killed.
“This is off; we can’t do this,” Mr. Trump told his aides, according to one official.
No announcement was made by the White House. In Kabul on Friday, Mr. Ghani’s officials told reporters that he planned to travel to the United States, and then hours later said he would not go.
But little was made of that at the time. The endgame of the talks seemed near, if not the timetable. Only then came Mr. Trump’s tweets on Saturday night disclosing that he had invited the Taliban and Mr. Ghani to Camp David — but called it off, citing the bombing.
The tweets took many in the administration by surprise; there was no reason for Mr. Trump to reveal what had happened, several officials said, especially since he has not given up on the idea of a negotiated settlement.
Hours later, Mr. Pompeo visited Dover Air Force Base for the arrival of the coffin of Army Sgt. Frist Class Elis Angel Barreto Ortiz, who was killed in the Kabul bombing. His presence was unusual for a secretary of state; the return of fallen American soldiers would be more traditionally attended by presidents or defense secretaries.
On Sunday, after their negotiating team held an emergency internal meeting in Doha, the Taliban said Mr. Trump’s decision to cancel the talks would hurt only the United States. The Afghan government blamed the Taliban, saying that the violence was making the peace process difficult.
American officials stressed that the peace drive was not over and the deal had been neither rejected nor accepted. With Mr. Trump especially, anything can happen.
But for the moment, at least, all sides seemed certain of one thing: Violence will now intensify. The war will go on.