President Obama always wanted to be the guy who successfully wound down both of George W. Bush's wars. He managed that in Iraq (with some assistance from the Iraqis, who basically kicked us out), and was on track to do the same in Afghanistan by the end of his term.

But with the Taliban moving from strength to strength in northern Afghanistan, Obama has decided to delay the date of withdrawal until after the end of his presidency. The manifest weakness of the Afghan government is, in turn, leading to calls for Obama to add more troops to "stabilize" the situation. In The New York Times, Thomas Jocelyn and Bill Roggio argue that "additional troops are needed, not fewer" — perhaps as many as 25,000.

This is a mistake. Afghanistan is lost, and the sooner we admit it to ourselves, the sooner we can stop pouring money and lives into a doomed imperialist project.

In 2009, President Obama announced he was going to try his hand at George W. Bush's "surge" idea, this time in Afghanistan, boosting the U.S. troop presence there by 30,000 for 18 months. For the same reasons the surge basically didn't work in Iraq, it didn't work in Afghanistan either, only even more so. (It did, however, get a lot of American soldiers and Afghan civilians killed or wounded.) At this point, nearly two entire presidencies have been spent trying to build some kind of competent democratic state in that country.

How's it working out? The Afghan government is almost indescribably corrupt, ranking 172 out of 175 countries in Transparency International's 2014 corruption measure. Awesome scandals from banking to education, some uncovered by the U.S. military itself, have consumed tens of billions of dollars. The last election was likely a huge fraud. Afghanistan now supplies 90 percent of the world's heroin — which is also practically the only non-foreign source of cash flowing into the country.

Just like in Iraq, the insurgents in Afghanistan are winning mainly because government forces are pitifully disorganized. The occupation has allowed some semblance of order, but has also interfered with the process of nation-building. Despite $65 billion in U.S. training and equipment, Afghan government forces are basically helpless without U.S. support.

We have seen this tape several times just in the last century: in Iraq; in Vietnam, with both the French and the U.S.; in Algeria with the French; in Angola with the Portuguese; in Afghanistan with the British, the Soviets, and now the U.S. Each time, foreign occupation — particularly the inevitable atrocities carried out by occupying troops, accidentally or otherwise — fueled insurgency and undermined the state. Each time, occupying powers got their self-image and reputation tangled up in the conflict, causing them to keep fighting far past the point of hopelessness.

And if 14 years of occupation isn't enough time to prepare Afghan forces to take on a few thousand militants with light weapons and armor, another two or three aren't going to do it. This is a political problem driven by the rottenness of the Afghan state, and at this point the U.S. cannot help any more. The government must gets its act together, or perish.

That brings us to the real question that animates practically all U.S. discussion of this issue: Islamist terrorism. Should the Taliban take Afghanistan again, do we just let them set up a jihadist state? No — but containment, not forever war, is the correct response. Assist stable states in the region, particularly those groaning under the load of hundreds of thousands of refugees. Blockade jihadists' sources of arms. Go after sources of financing (particularly from the Gulf states and Saudi Arabia). Above all, attack the simple bureaucratic incompetence that allowed the 9/11 hijackers to operate in the U.S. in the first place.

American commentators typically trip over one another to pay fealty to the troops. It's true that the U.S. military is powerful. But it simply is not a good tool for transforming foreign nations into Western-style democracies.