The description of what went right for the U.S. and NATO in Afghanistan is short. After the 9-11 attacks on America, the need to eliminate terrorists operating out of Afghanistan was patently clear. The American and NATO invasion of Afghanistan in October 2001 quickly defeated and chased the governing Taliban and their fellow al-Qaida extremists into sanctuaries in Pakistan. This fundamental war aim was promptly achieved, and a new Islamic democratic government was installed.

But the achievement of the war aim was not maintained. After nearly 20 years of fighting, the Taliban have returned along with al-Qaida and ISIS. What went wrong?

Under the U.S. Army/Marines’ 2006 Counterinsurgency Manual, the military’s strategy was “clear, hold, build.”  The 2014 update to the manual now dubs this strategy: “Shape-clear-hold-build-transition.” The theory is once a district is cleared, held, institutions and infrastructure built, and the attitude of the local population “shaped,” the new government can be transitioned in. The policy should have been “clear, hold, build and pursue,” with the main effort being constant pursuit. The failure to relentlessly chase down and eliminate the insurgents as they sought to return allowed them to return and re-establish themselves.

A nascent pluralistic Islamic democratic government faces hostile and decidedly different ancient religious traditions in a land long teaming with Islamic fanatics and Jihadis. It likely can only succeed if the militant extremists who are implacably opposed to such a government are eliminated or kept thoroughly marginalized. ISIS’s overrunning large parts of Iraq when that country’s nascent democracy was left to fend for itself illustrates the type of enduring commitment that is needed to give a democratic government a chance in these hostile environments.

Renowned military theorist Carl von Clausewitz observed a nation’s “moral forces” are crucial for success in war.  Previous British and Russian failures in Afghanistan teach that war there for outsiders is to be avoided unless it is absolutely necessary, as it was in 2001. Once committed, for successful war in places like Afghanistan, western leaders must be able to maintain their nation’s “moral force.” Initially and throughout, they must explain to their nations what they are getting into, the realistic commitment of “clear, hold, build and pursue” it will require, and the reasons why the people should accept and support the accompanying casualties, loss of life and loss of the nation’s treasure.

Save for a few, like John McCain and Leon Panetta, America’s political and military leadership never understood this need. They did not marshal the nation’s “moral forces” for this commitment, but instead hopelessly relied on “clear, hold and build” with sporadic surges of forces.

Perhaps the closest historical analogy is the Spanish Guerrilla War against Napoleon. Invading Spain in 1807, Napoleon swiftly vanquished its regular armies and installed his brother, Joseph, king. Napoleon expected Spaniards to acquiesce to French rule like other French-conquered nations and, like them, even appreciate some of the more liberal policies of France born of the French Revolution. What he did not anticipate and understand was the deep-rooted fanaticism of Spaniards for church and state.

A vicious guerrilla campaign soon erupted. The term “guerrilla” originated here and means “little war.”   Guerrillas terrorized the countryside, made road travel unsafe, and limited French troops to the towns and outposts. Guerrillas ambushed and killed isolated French soldiers.

In the province of Andalusia, Marshal Jean-de-Dieu Soult had rare success against the guerrillas. He organized “flying columns” of French troops that, with the help of knowledgeable locals, constantly swept the plains, countryside, and mountains relentlessly chasing and killing the guerrillas. Andalusia was secure.

According to the 2006 Counterinsurgency Manual, the Spanish Guerrilla War lasted close to six years, ultimately requiring about three-fifths of French armed strength. It helped facilitate Wellington’s advance through Portugal and Spain and Wellington’s threat to Napoleon’s strategic rear as Napoleon advanced into Russia in 1812. Of Napoleon’s failure against the guerrillas, the 2006 Manual states: “At the theater level, a complete understanding of the problem and a campaign design that allowed the counterinsurgency force to learn and adapt was lacking.” The same can be said about Afghanistan.

Had Soult’s example of relentless pursuit been consistently followed from the beginning, Afghanistan likely would have stayed secure with fewer troops needed to keep the Taliban and other fanatical Islamists in Pakistan or on the run. The Islamic democratic republic would have had a realistic chance to root in a land with decidedly different ancient traditions.

Before America again determines that it must take the risk of a guerrilla war in a strange and foreign land, the flaw in the Counterinsurgency Manual must be corrected.