I am a United States Army general, and I lost the “global war on terror.” It’s like Alcoholics Anonymous; step one is admitting you have a problem. Well, I have a problem. So do my peers. And thanks to our problem, now all of America has a problem, to wit: two lost campaigns and a war gone awry.

I was never the overall commander in either Afghanistan or Iraq. You’d find me lower down the food chain, but high enough. I commanded a one-star advisory team in Iraq in 2005–06, an Army division (about 20,000 soldiers) in Baghdad in 2009–10, and a three-star advisory organization in Afghanistan in 2011–13. I was present when key decisions were made, delayed, or avoided. I made, delayed, and avoided a few myself. I was on the ground a lot with small units as we patrolled and raided. Sometimes I was communicating with strategic headquarters in the morning and then grubbing through a village with a rifle platoon by sunset. Now and then, Iraqi and Afghan insurgents tried to kill me. By the enemy’s hand, abetted by my ignorance, my arrogance, and the inexorable fortunes of war, I have lost eighty men and women under my charge, with more than three times that number wounded. Those deaths are, as Robert E. Lee said at Gettysburg, all my fault.

What went right in this war involved the men and women who fought it. At the tactical level — the realm of vicious firefights and night raids — the courage, discipline, and lethality of our Americans in uniform stand with anything accomplished in the Civil War, both world wars, Korea, or Vietnam.

What went wrong squandered the bravery, sweat, and blood of these fine Americans. Our primary failing in the war involved generals. We should have known better. In military schools like West Point, Fort Leavenworth, Quantico, and Carlisle Barracks, soldiers study the great minds who have tried to win wars across the ages. Along with Thucydides, Julius Caesar, and Carl von Clausewitz, the instructors introduce the ancient wisdom of Sun Tzu, the Chinese general and theorist who penned his poetic, elliptical, sometimes cryptic Art of War twenty-two centuries ago. Master Sun put it simply: “Know the enemy and know yourself; in a hundred battles you will never be in peril.” We failed on both counts. I know I certainly did. As generals, we did not know our enemy — never pinned him down, never focused our efforts, and got all too good at making new opponents faster than we could handle the old ones.

We then added to our troubles by misusing the U.S. Armed Forces, which are designed, manned, and equipped for short, decisive, conventional conflict. Instead, confident of our tremendously able, disciplined troops, and buoyed by dazzling early victories, we backed into not one but two long, indecisive counterinsurgent struggles to which our forces were ill-suited. Time after time, as I and my fellow generals saw that our strategies weren’t working, we failed to reconsider our basic assumptions. We failed to question our flawed understanding of our foe or ourselves. We simply asked for more time. Given enough months, then years, then decades — always just a few more, please — we trusted our great men and women to succeed. In the end, all the courage and skill in the world could not overcome ignorance and arrogance. As a general, I got it wrong. And I did so in company with my peers.

The war resulted in almost 7,000 American dead, seven times that many wounded, and a much higher number dealing with psychiatric injuries both great and small. Our Coalition allies sustained more than 1,400 fatalities. In Afghanistan, at least 21,000 civilians were killed, although statistics there are often unreliable. Iraqi civilian deaths, more accurately estimated in the face of much higher levels of violence, stand around 140,000.

The war also cost a lot of U.S. money, more than a trillion dollars since September of 2001, about two thirds of that spent on Iraq, the rest on Afghanistan. Two recent studies estimated the total cost, including future medical care for the wounded, even higher, at four to six trillion dollars. Just how much permanent damage this expenditure did to our country’s economy is hard to determine. War funding certainly elevated the federal government’s annual deficits and added a few more unwelcome strata to the mountain of long-term debt. Both political parties pointed accusing fingers even as the spending continued. By any measure, fighting a protracted war on the opposite side of the world with a volunteer military and a lot of expensive contractors is not cheap.

For all of this pain, what resulted? I agree with what Barack Obama said at Bagram Air Field in May 2012: the Al Qaeda leadership has indeed been devastated. The organization that planned and executed the 1998 embassy attacks in Kenya and Tanzania, the 2000 U.S.S. Cole strike, and 9/11 no longer exists. Terror cells take the name and claim the heritage, but centralized Al Qaeda has been crushed.

A broad chasm, however, gapes between what the United States accomplished and what it aspired to do. In the immediate wake of the Al Qaeda assault, America wanted victory over Islamist terrorists the world over, as well as suppression of their various hosts and enablers. The citizenry demanded a strong response. The U.S. Congress reflected that sentiment by granting the military broad authority to retaliate against and, in time, to pre-empt Al Qaeda and other groups of its kind. A clutch of White House policymakers even advocated remaking the Middle East in America’s image: democratic, committed to the equality of women, valuing education, and embracing interaction with the global economy and free societies. Rhetoric soared.

George W. Bush’s war began narrowly, knocking out Al Qaeda and its Taliban backers in Afghanistan. Shortly after the 9/11 attacks, several of the basic tasks were fulfilled, not perfectly, not completely, but probably close enough. Had we stopped there and reverted to the long, slow Clinton-era squeeze on terror cells and Islamist supporters, we may have done the job.

The swift seizure of Baghdad offered another opportunity to close out the conventional military phase and go back to the slow, steady, daily pressures of global containment of Islamist threats. That moment passed. Instead, satisfaction in brilliant opening-round victories, initial popular acclaim in America, encouragement from many allies, and more than a little pride influenced Bush to try for more. With minimal domestic debate — and, notably, no known military objection — the administration backed into two lengthy, indecisive counterinsurgency campaigns. The limited ends of containing Islamist movements and attacking Al Qaeda faded into the background, at least until Sunni Arabs and a resurgent Taliban made it obvious that neither Iraq nor Afghanistan seemed likely to move readily into the orbit of western democratic republics. By the decade’s end, chastened, bloodied, and weary, America returned to containment and limited operations.

We have been to this rodeo before. The same cycle played out early in the Cold War, in 1950, when President Harry S. Truman intervened on the Korean peninsula. After sobering early reverses, the brilliant Inchon invasion enveloped and largely destroyed the North Korean divisions, and the initially narrow task of defending South Korea became a great crusade to liberate the Communist north. Massive Chinese intervention compelled Truman to go back to the earlier, limited policy of protecting South Korea — half a loaf, but better than none. Still, the heady promises and then dashed hopes torpedoed Truman’s domestic popularity and led to the election of Dwight D. Eisenhower. He quickly wrapped up the Korean armistice. During his tenure in office, the former general carefully avoided other proposed interventions, except under the most carefully defined conditions.

You could see Bush as Truman and Obama as Eisenhower, the former over-reaching in misplaced good faith, the latter pulling back and strictly metering when and where the United States took action. As in the 1950s, the basic strategy made sense. But containment demanded patience and limits — the long game. It also required a U.S. commitment, restricted in numbers but undeniable, as Eisenhower provided in Korea, where American forces remain to this day. In that aspect, Obama faltered, with consequences we have yet to see.

Tactically, though, a lot went right. Leaving aside the wisdom of the twin counterinsurgencies, the decision to mobilize the National Guard and Army Reserves guaranteed support for the troops in every county in America. Guardsman George W. Bush in 2001, like Guardsman Harry S. Truman in 1950, grasped fully the strong ties between American communities and their citizen soldiers. The war declined steadily in popularity, but those fighting it did not.

A second determination, closely aligned to the first, shaped the scale of the war. In 2007, the United States allowed a relatively modest increase in the size of the regular Army and Marine Corps and essentially no additions to the Navy and Air Force. When needed, substantial reinforcements came from Guard and Reserve unit call-ups. This policy accorded well with a long-term containment strategy, and lowered the strain on American society.

A third resolution flowed from the first two, as well as from the upper uniformed ranks’ hard-won experience in Vietnam. The services chose to rotate forces by unit. Because battalions prepared, deployed, and returned as teams, they did so over and over effectively. In this, the United States validated the lessons learned by British and French regulars during centuries of overseas duty.

Protecting those forces came harder, especially in light of the enemy’s reliance on I.E.D.’s. Early in the war, the entire wheeled-vehicle fleet proved unable to shrug off a determined pistol shooter, let alone absorb the effects of massive, buried racks of artillery shells. Losses incurred during the first months of fighting demanded a better solution, and fast. Within months after the Iraq campaign began, American industry fielded an entire new set of armored Humvees and affiliated cargo trucks. Factories produced thousands of V-hull MRAPs in the second half of the war. The military also organized dedicated I.E.D. location and clearance teams. With each passing year, I.E.D.’s became less and less effective in harming Americans and our allies, though the enemy used more and more of them. In future conflicts, America’s enemies will surely use I.E.D.’s. The United States now has the wherewithal to meet that challenge.

Above that tactical excellence yawned a howling waste. The civilian leadership provided an adequate containment strategy. The U.S. Armed Forces, led by its admirals and generals, fielded capable, resilient combat units. With few exceptions, small U.S. units proved lethal to their opponents. A gaggle of one-sided firefights, however, does not victory make, especially against guerrilla units.

The war required a way to use a tactically superb force to contain terrorist adversaries. In this, America’s generals failed. We found ourselves impaled and bogged down in not one but two Middle Eastern countries, and this on the best advice of educated, experienced senior military men and women, all of whom had studied Vietnam in their service schools. Over time, piece by piece, the generals recommended slogging onward, taking on two unlimited irregular conflicts with limited forces. Absent a realistic campaign concept in both countries, wars of attrition developed.

The shiny objects of counterinsurgency theory ended up delivering far less than expected or hoped. Counterinsurgency works if the intervening country demonstrates the will to remain forever. That applies in colonies and territorial annexations with the supervising power in full control. And even then, it doesn’t always work, as France learned in Indochina and then Algeria. Once it becomes clear that the external forces won’t stay past a certain date, the guerrillas simply back off and wait it out. Had America treated Afghanistan and Iraq from the beginning as the future fifty-first and fifty-second states, counterinsurgency theory offered a way to pacify them. Saddled with incomplete authority over Afghan and Iraqi internal affairs, inept host governments, and ticking clocks, we could not do it.

A sensible look at American military strengths in 2001 clearly showed an alternative to grinding counterinsurgency campaigns. As a joint force and as individual services, the U.S. military recognized the value of short, decisive conventional conflicts waged for limited ends: Panama in 1989, Iraq in 1991, Bosnia in 1995, and Kosovo in 1999. Force composition and training reflected this short-war bias. Employed in this way, American airpower and special forces in Afghanistan in 2001, and airpower and armor in Iraq in 2003, worked as advertised.

Had short conflicts ended our efforts, we would have been fighting well within our means. Admiring war colleges would have studied the brilliant opening rounds as models of lightning war. But our success undid us. Rightly impressed by the innovation and speed of the initial attacks in Afghanistan and Iraq, and thoroughly convinced of the quality of our volunteer troops, successive generals in command at the four-, three-, and two-star levels signed on for more, a lot more, month by month, then year by year. We were drawn into nasty local feuds, and we took on too many diverse foes, sometimes confusing opponents with supporters and vice versa. Then we compounded that mistake by misusing our conventionally trained military to comb through hostile villages looking for insurgents. Once it became evident that we would not stay, something we knew in Iraq by 2008 and in Afghanistan by 2011, we continued to press on in vain hopes that something might somehow improve. Our foes waited us out.

Many generals, including some at the very top, saw this problem as it developed. They shared their views, both inside the military and with civilian leaders. In 2003, Tommy Franks and Jack Keane thought we should back out of Afghanistan and Iraq and expected to do so, but neither pressed the case very hard. That same year, John Abizaid warned of a growing insurgency in Iraq, and by 2004 he had joined George Casey to warn that at best America could buy time for the Iraqis to win their own war. They assumed the Bush Administration understood that this would be an effort of decades. They assumed wrongly. Successive commanders in both theaters — Odierno, McChrystal, Petraeus, Allen, Dunford — made equally poor assumptions that, despite every indication to the contrary, the Obama Administration would commit to major long-term U.S. troop deployments. Somehow, on this most vital issue of all, during hundreds of hours of meetings, the uniforms and the suits managed to talk past each other. Sergeants and captains, not to mention our fellow citizens, count on generals to sort out such fundamental strategy. We didn’t.

It’s noteworthy that in the 2006 surge decision, President Bush overruled all of his senior field commanders and the Joint Chiefs of Staff, who urged him to limit the American effort, not escalate. In the 2009 surge decision President Obama sought recommendations from all the top admirals and generals, then made up his mind and ordered a solution different from the one the military wanted. In these two prominent cases, and many others, senior military voices were definitely heard. Limits, curbs, and reductions came up. But simply cutting our losses and pulling out did not. The record to date shows that no senior officers argued for withdrawal. Instead, like Lee at Gettysburg, commander after commander, generals up and down the chain, kept right on going.

Once we’d made that decision, our options shrank. Stay the course. Add forces. Pull out. Over time, in both countries, all three approaches were tried. Only the third one, pulling out, worked, and that in the finite sense that it ended the U.S. involvement. But it left both friends and foes behind, sowing the seeds for the trouble we now see in Iraq.

As the United States military refocuses on its core strength — rapid, decisive conventional operations — it must come to grips with the war on terror fought since 2001. Good ideas and bad, lessons learned, re-learned, and unlearned — all deserve thorough scrutiny and discussion. In the 1970s and 1980s, following the end of the war in Vietnam, the American military took an uncompromising look at itself. The wartime generals had passed on, many of them unable or unwilling to see the flaws in the institution they had built. Those who fixed it were the younger leaders in Vietnam, Chuck Horner and Ron Fogleman of the Air Force, Norman Schwarzkopf and Gordon Sullivan of the Army, Leighton “Snuffy” Smith and Jay Johnson of the Navy, and Al Gray and Carl Mundy of the Marine Corps, along with NCOs and officers of all ranks. Today, similar work is underway. The colonels have started it, but the younger men and women, both ennobled and scarred by the war on terror, will bring it to fruition. They, not today’s generals, will figure it out.