About two weeks ago, President Trump’s national security team finally presented their long-awaited strategy for Afghanistan. Defense Secretary James Mattis, National Security Adviser H.R. McMaster and the rest of the National Security Council’s “principals committee” briefed the president on their new strategy.

Mr. Trump reportedly criticized them harshly and rejected their entire plan because it was a rehash of the way we’ve fought the Afghanistan war, unsuccessfully, for almost 16 years. It reportedly included, for example, a proposal by Gen. McMaster for a troop increase with a four-year timeline that the president could promote at an upcoming NATO summit.

Months ago, Mr. Mattis told Congress that we aren’t winning in Afghanistan. In fact, we are stuck in a nation-building quagmire imposed by President Bush whose mistake was compounded by President Obama.

Mr. Trump had given Mr. Mattis the authority to decide troop levels in Afghanistan. Plans were being made to send several thousand to join the more than 8,000 already there. That authority apparently has been revoked. The president was considering a complete withdrawal from Afghanistan, sending the Pentagon and the Afghan government into panic, and has since withdrawn from withdrawal.

Afghanistan seemed easy at first. We went to war in October 2001, and in only a month drove the Taliban out of the capital city of Kabul. But the Taliban have never been defeated. Their attacks continue almost everywhere in Afghanistan and they now reportedly control about half the country.

For 16 years we have been training the Afghan government how to function and its army how to fight. About eight years ago we even sent thousands of pomegranate trees along with Missouri farmers — national guardsmen — to give Afghanis the incentive to grow something other than opium poppies. Nothing has worked.

In 16 years, we have suffered about 2,400 combat deaths in Afghanistan and spent over $1 trillion. Continuing the nation-building charade will achieve nothing more than to spend more lives and treasure.

Mr. Trump’s idea of simply withdrawing from Afghanistan reflected an understandable frustration with failure but it is mostly wrong.

If we withdraw our forces, Afghanistan would revert quickly to what it was before 9-11. Neither the Taliban nor al Qaeda has been destroyed. ISIS has established large training camps in Afghanistan. (The April use of the “mother of all bombs” in Afghanistan destroyed a large one.) They and other terrorist networks will turn Afghanistan into a safe haven for every terrorist network that wants to commit attacks in the West.

Mr. Trump’s generals rose to high rank in the nation-building era. With the exception of Gen. McMaster, who insists that there is no connection between Islam and terrorism, Mr. Trump’s teams are not ideologically Mr. Obama’s generals. Nevertheless, their thinking is hobbled by long immersion in nation-building and by Mr. Trump’s failure to set a policy goal from which the generals can devise a strategy.

Mr. Trump should decide that goal, quickly and clearly, to include both Afghanistan and neighboring Pakistan, which has been covertly supporting a variety of terrorist networks including the Taliban. When he does so, he should make it clear to his team that ideas that have been rejected before are still open to adaptation.

Principal among them is the ideological war that the Islamists have waged against us since bin Laden’s 1996 fatwa published in a London newspaper. Messrs. Bush and Obama refused to fight the ideological war. Mr. Trump will have to face the fact that no matter what else we do, we cannot win in Afghanistan or defeat Islamist terrorism anywhere else, unless we defeat the Islamist ideology.

In late 2009 vice president Joe Biden advocated a “terror overwatch” strategy. His plan would have rejected the troop surge Mr. Obama authorized in favor of increased training of Afghan troops and greater use of drones and special forces to strike terrorist targets. Mr. Trump is reportedly considering a version of the Biden idea.

Mr. Biden’s approach had two fatal flaws. First, any use of drones and special forces has to rely on specific, actionable intelligence that is — or was at the time — in short supply. Second, it relied on training of Afghan forces, which had already proven a failure.

If our intelligence is by now so greatly improved and can be sustained by spy satellites and spies on the ground, pieces of Mr. Biden’s approach could be adapted to a new strategy. It would have to be accompanied by more American air power than drones can provide, and the commitment to that strategy would have to be open-ended. Striking targets identified in both Afghanistan and Pakistan would have to be done routinely without restrictive rules of engagement.

That would be the beginning of a strategy which could be completed by a commitment to fighting the ideological war. The commitment would be enormous, proportional to the size of those nations.

It’s questionable whether our air and intelligence forces have the ability to sustain it for long. But it is the sort of risk we will have to take to prevent Afghanistan from being the source of another attack as devastating as 9-11. It’s the best we can do until we defeat the enemy’s ideology. If we don’t, the war will never end.

• Jed Babbin served as a deputy undersecretary of defense in the George H.W. Bush administration. He is a senior fellow of the London Center for Policy Research and the author of five books including “In the Words of Our Enemies.”

The Washington Times Comment Policy

The Washington Times is switching its third-party commenting system from Disqus to Spot.IM. You will need to either create an account with Spot.im or if you wish to use your Disqus account look under the Conversation for the link "Have a Disqus Account?". Please read our Comment Policy before commenting.