In anticipation of Barack Obama’s speech on Afghanistan Wednesdayevening, I spent some time reading about the history of American involvement in that forlorn country over the past 30 years, re-familiarizing myself with long-forgotten names and details. It’s a history that is sad, comic, and frustrating by turns, rational only intermittently, and courageous (in the sense of far-sighted) pretty much never. More importantly, it’s a history that suggests that no matter what Obama says in this address, we’re going to be in that place doing one thing or another for the next 30 years. And not just there: We’ll be in Egypt and Libya and Syria, too. And the thing is—we need to maintain a presence in these all of these places. But in the future, we might at least try to make our presence a smart one.

It’s practically an ancient world to us now, the cauldron of Cold War competition, but that of course is how we got involved in Afghanistan in the first place. A Soviet puppet regime in Kabul was, ah, dispatching political enemies at an alarming pace, and in those days we could tolerate that sort of butchery only if one of our guys was doing it. Our backing of the mujahideen, which included that bin Laden fellow and which undoubtedly boiled down to the United States arming and training future al Qaeda fighters, is well known. Perhaps forgotten now is the fact that the Carter administration first approved funding anticommunist guerrillas in the country in July 1979, fully half a year before the Soviet invasion, probably in a conscious attempt to draw the Russkies into their own Vietnam. Ronald Reagan continued the policy and then some, limning the “courageous” future terrorists, who in 1983 he called “an inspiration to those who love freedom." Operation Cyclone, the CIA’s name for the program that backed the mujahideen, was one of the longest and most expensive covert operations in U.S. history—then, as now, we were probably spending more per year on making war in Afghanistan than the country even generated in legal (i.e., poppy-free) gross domestic product.

The Soviets finally pulled out in 1989, just as their world was collapsing in on them. They are certainly more to blame for the Stone Age conditions in the country than the U.S. is (Soviet bombing of Kandahar and Herat nearly obliterated both cities). But for the Stone Age regime that emerged out of the rubble, we must take credit. It was not, let us say, one of Bill Clinton’s finer moments when his administration at first decided in 1996 that maybe it could work with these Taliban people. There was heavy interest in those days in an oil pipeline that might run through the country. Unocal, the U.S. company that wanted the contract, worked closely with the administration, pledged to rebuild Kandahar, and donated money to the Center for Afghanistan Studies at the University of Nebraska while the Taliban were closing down girls’ schools and stoning apostates. The bombings of the two U.S. embassies in Africa in 1998, which were quickly traced back to al Qaeda operating out of Afghanistan, forced a change in posture.

The more recent history is more familiar, but no less unnerving. The mistake George W. Bush made was not in invading; any country would and should have retaliated for an act like the 9/11 attacks. The mistake was in doing it on the cheap, with only 12,000 troops to start. One still can’t say this in polite company in Washington without drawing a condescending stare from some oily sycophant of power, but it was obvious even in the fall of 2001 that Bush held back in Afghanistan so he’d have more fire power for Iraq. This gave us the missed opportunity in Tora Bora and a war that will soon be a decade old. Obama has at least handled the matter with comparative honesty in that he has done so far more or less exactly what he said as a candidate he would do.

Now what? The war can’t be “won” in any conventional sense in the near term—victory means a stable and democratic Afghanistan, which will take years if it happens. But it needn’t be lost either. Defeat would mean a Taliban back in control and able again to sponsor terrorism on a grand scale. Brian Katullis of the Center for American Progress, a leading expert on these matters, says that’s a small risk at this point. “The intelligence networks we’ve established will endure,” he says. “We’ve gotten very, very good at tactical counterterrorism, and I don’t think we’ll ever see a situation in Afghanistan again like we did in 2000 and 2001.”

And yet, no one can possibly think that when we withdraw the problem will be over. It will simply become something we’ve chosen to stop thinking about. Once we do that, something else will happen, and we’ll just have another short-term reaction, affixing another panicked and wrong-headed band-aid in the same way we’ve been doing. But what’s happening in Afghanistan and across the region is the beginning of a transformation toward freedom that will probably take at least two generations to make serious progress. The United States can’t sit off to the side while that happens. We have to stay engaged with these countries, and some of that engagement (horrors!) will inevitably involve military and intelligence work. This is our job. If we don’t do it, China will. Democrats and liberals should insist on this engaged posture and show the world that there’s a way to beinvolved that isn’t the Bush-Cheney way.

So I hope that Obama treats Wednesday night as an opportunity to make that case and not just to signal to Americans that they can start washing their hands of this problem. That mind-set will merely ensure that we’ll stumble through the next 30 years as we have the last.