By Ian Bremmer
The views expressed are his own.

When President Barack Obama announced in late 2009 that he would send an additional 30,000 troops to Afghanistan, few were as pleased as Defense Secretary Robert Gates. A holdover from the George W. Bush administration, Gates had championed the 2007 surge of troops into Iraq, a move that helped turn both the tide in that country and public opinion in the U.S. on its future. Gates and the generals hoped for similar success against the Taliban.

But how do you measure success in a place like Afghanistan? Soldiers, no matter how many, can’t build democratic, financial and industrial institutions overnight. At best, they can help make Afghans safer and life much harder for those who would launch attacks beyond the country’s borders. By that measure, the record of both surges is mixed, if generally positive. But post-surge, one thing is certain: Obama allowed Gates to prosecute the war on his terms, but new Defense Secretary Leon Panetta will be asked to implement a plan that has less to do with Kandahar than with Capitol Hill.

Withdrawal is the right move, maybe the only move, for Team Obama. The president has gotten the politics of the moment exactly right, yet again. In the first half of his term, he retained Bush’s team at the Pentagon and reshuffled his top generals, namely David Petraeus, through various leadership positions in Iraq and Afghanistan. A surge that seemed to be working was allowed to play out, and Bush was likely to take the blame if the strategy failed. But President Obama knows that Bush’s burdens are now his—the economy, jobs and the wars.

Now the president has put Petraeus, who understands how to use intelligence as a military commander, in charge of the CIA. In this role he’ll likely use agency operatives to conduct the kinds of covert operations that will keep Afghanistan (and Iraq) free of influence from large terrorist networks. Panetta, having learned the CIA’s capabilities during his tenure as its chief, takes charge at a Pentagon braced for budget cuts. The war is being moved off of the Defense Department’s books, but that doesn’t mean the U.S. can afford to simply pack up and head home. Afghanistan will become a quieter conflict, allowing for “nation-building here at home,” as the president said in his statement announcing the end of the surge, and a forward-looking platform for his re-election campaign next fall. Bush is the president who promised to avoid nation-building, but it’s Obama who is keeping that promise.

If Obama can afford to turn to domestic challenges, that’s largely thanks to the stunning successes of special forces and counter-terror operations—in both Iraq and Afghanistan. The effect of the troop surges on the long-term prospects for stability in these two countries is debatable, but bin Laden is dead and al Qaeda has been routed. This won’t be last time you read about the successful mission to kill Osama bin Laden in Pakistan vis-à-vis the coming presidential election.

But what if Obama is wrong? What if the Taliban refuses the president’s offer to talk? What if China or Russia or both decide that departing U.S. troops create opportunities for a bid to lay claim to the country’s vast natural resources? Worst of all, what if Afghanistan starts to crumble? What if the corrupt men that President Karzai has been protecting allow the country to again become an international locus for terrorists? What if the 68,000 U.S. troops set to remain in the country find themselves besieged by tribal warlords or Qaeda militants? What if Iran and Pakistan, for entirely different reasons, create turmoil in Afghanistan that again destabilizes the region?

In other words, it would take less than a miracle for Afghanistan to become Obama’s problem all over again. Even if Republicans nominate a candidate who wants to end the war, conservative pundits could still score points at the president’s expense. Obama — the president who killed Osama bin Laden — could find himself painted as Jimmy Carter, a leader reacting to events rather than shaping them.

More damaging still, a flare-up in Afghanistan could divert Obama from his primary electoral challenge, making it impossible for him to focus his closing political argument on job creation and the health of the American economy.

That’s a fight the president knows he must win.

This essay is based on a transcribed interview with Bremmer.

PHOTO: An Afghan shepherd walks with a flock of sheep past a U.S. Marines armored vehicle of the Weapons Company, 1st Battalion, 3rd Marines outside the Camp Gorgak in Helmand province, southern Afghanistan July 5, 2011. REUTERS/Shamil Zhumatov