There are certain enduring rituals in U.S. foreign policy that are pursued whether they have any chance of success. Every administration since Franklin D. Roosevelt’s has tried to improve relations with Moscow. Every administration since Harry S. Truman’s has tried to solve the Israeli-Arab dispute. Every administration since Jimmy Carter’s has tried to persuade the Iranian mullahs to behave better. And every administration since Bill Clinton’s has tried to negotiate with the Taliban.

As Ahmad Majidyar of the American Enterprise Institute noted in an eye-opening report: “Between 1995 and 2000, declassified records show, American diplomats held more than 30 meetings with the Taliban to persuade the group to close down terrorist training camps in territories under its control. . . . In 1998, for example, the Clinton administration held direct talks with the Taliban and obtained a pledge that the Taliban would ‘not allow terrorists to use Afghanistan as a base for terrorism.’ A few months later, however, al Qaeda carried out the deadly bombings of U.S. embassies in Kenya and Tanzania.”

President George W. Bush wasn’t in a negotiating mood after the terrorist attacks of Sept. 11, 2001, but as the United States and its allies became bogged down in Afghanistan, talks commenced at the local level to persuade Taliban fighters to “reconcile” with the Western-backed government. Those attempts bore scant fruit, and the security situation deteriorated. When Barack Obama became president in 2009, he tripled U.S. troop numbers while stating that “the only way to end this conflict and to achieve a full drawdown of foreign forces from Afghanistan is through a lasting political settlement between the Afghan government and the Taliban.”

Hamid Karzai, then the president of Afghanistan, made negotiations with his “Taliban brothers” a top priority, establishing a High Peace Council for that purpose. The fact that the first chairman of the peace council, Burhanuddin Rabbani, was assassinated by a Taliban suicide bomber in 2011 should have been an augury of the difficulties to come. But hope dies hard. The Obama administration encouraged the Taliban to open a political office in Qatar in 2013 to facilitate talks that went nowhere.

Now, the Trump administration has announced it is willing to hold direct talks with the Taliban, bypassing the government in Kabul, which the Taliban views as an illegitimate Western lackey. Moscow is convening its own peace talks, minus the United States. Afghan President Ashraf Ghani, for his part, has asked the Taliban for a two-month truce, building on the success of a three-day cease-fire in June.

I hate to be the bearer of bad news, but there is no reason to think these outreach efforts will be any more successful than those in the past. The Colombian government was able to negotiate an end to that country’s 50-year civil war because it had defeated the FARC rebels. But the Taliban, with unflagging support from Pakistan, is far from defeated. It is winning, not losing. During the past few weeks, it has staged devastating attacks in Ghazni, Faryab, Baghlan and Takhar provinces, killing hundreds of soldiers and police officers. Meanwhile, the Islamic State, a competing terrorist group, killed 34 people in a bombing in Kabul that targeted the Shiite minority.

Since 2015, reports the Pentagon’s special inspector general for Afghanistan reconstruction, government control or influence over the country’s districts has declined by 16 percentage points. Today, the government is said to “control or influence” 65 percent of the population, while 23 percent is “contested” and 12 percent under Taliban control. Those figures, as in the “hamlet evaluation system” employed in Vietnam, no doubt considerably understate the degree of insurgent control in the countryside. The Afghan security forces are taking such heavy casualties that their losses are no longer publicly reported.

The only thing preventing the fall of the government is the presence of 14,000 U.S. troops. But the United States’ determination to remain in Afghanistan after nearly 17 years is wearing thin. President Trump only reluctantly approved a small increase in the size of U.S. forces a year ago under pressure from then-national security adviser H.R. McMaster. McMaster is now gone, the security situation hasn’t improved, and Trump is said to be so frustrated that he is once again considering a far-fetched scheme to pull U.S. troops out and turn over their mission to Blackwater founder Erik Prince’s mercenaries.

If you were the Taliban, why would you negotiate now? From the Taliban’s perspective, an agreement would only make sense if, like the Paris Peace Accords with North Vietnam in 1973, it was supposed to provide the United States a “decent interval” between its pullout and the defeat of its local allies.

The United States won’t achieve its aims in Afghanistan — to keep the country from being overrun by extremists allied with al-Qaeda and other international terrorist groups — through diplomatic sleight of hand. We will have to keep 14,000 or so troops there indefinitely, as the British kept troops in the region for 100 years during the 19th and 20th centuries, or we must be prepared for the emergence of another Islamic State-like terrorist state. The least bad option, I believe, is to maintain our troop presence as an insurance policy against a serious strategic setback and a humanitarian catastrophe. But we should do so without illusions about the imminence of a peace settlement.