Mr. Trump has long lamented the cost of “endless wars,” and by the time he took up direct negotiations with the Taliban, he knew American voters were interested mostly in one thing: ending participation in a war that has now dragged on for more than 18 years, its objectives always shifting.
When historians look back at the moment, they may well conclude that Washington ended up much like other great powers that entered Afghanistan’s rugged mountains and punishing deserts: frustrated, immobilized, no longer willing to bear the huge costs. The British retreated in 1842 after suffering 4,500 killed, amid massacres that preceded the invention of the roadside bomb. They gave up their sovereignty over the country in 1919, in another retreat that heralded the beginning of the unwinding of an empire.
The Soviet Union abandoned its decade-long effort to control the country in 1989, months before the fall of the Berlin Wall marked the collapse of the Communist superpower. That led to the chaos and power vacuums that Bin Laden exploited, and that the United States vowed it would never again allow to fester.
The American-led attack began on Oct. 7, 2001, with the name “Operation Enduring Freedom.” Mr. Bush, in an address to the nation from the Treaty Room of the White House, promised to “win this conflict by the patient accumulation of successes, by meeting a series of challenges with determination and will and purpose.”
After the destruction of the twin towers of the World Trade Center, a plane that hit the Pentagon and another that crashed in a field in Pennsylvania, the country was behind him. While a few warned of the dangers of entering the “graveyard of empires,” it seemed more a war of retribution and justice seeking than an effort at nation building.
Yet inevitably, mission creep set in.
After Bin Laden was hunted down in Pakistan in May 2011, and with Al Qaeda a much-diminished threat, politicians struggled to explain what American troops were fighting to accomplish. More than 2,400 service members have died in combat since the invasion, according to the website icasualties.org. Neither Mr. Obama nor Mr. Trump could make a plausible case that after nearly two decades the United States had much of a role to play other than prop up a weak democracy.
For a while, at least, that role seems likely to continue.
The accord signed on Saturday — with Secretary of State Mike Pompeo overseeing the moment but not actually signing it himself — will initially bring down American troop levels to about 8,600 from about 12,000 now. That is almost exactly where they were three years ago, at the end of Mr. Obama’s term. That is the minimum number of Special Operations forces, intelligence officers and support and security personnel that the Pentagon and C.I.A. believe are necessary to hold the capital, Kabul, battle militants of the Islamic State and advise an Afghan military that remains, at best, a fractured, inconsistent fighting force after close to two decades of training and billions of dollars in American and NATO investment.