It's the most understandable, intuitive and tempting mistake in geopolitics: secretly pay a powerful foreigner to do what you want. The CIA, like many spy agencies, has done it throughout its history, and now we know it helped undermine the America's longest war.

Nearly every month since the war began in 2001, the CIA has sent a guy over to Afghan President Hamid Karzai with a bag – sometimes a suitcase, sometimes a backpack, sometimes a shopping bag – full of cash. His former chief of staff says they used to call it "ghost money," and it totals tens of millions of dollars, according to an eye-opening New York Times story. Quite the hypocritical twist from a sponsor country that so frequently hectors Karzai about corruption. "The biggest source of corruption in Afghanistan," a U.S. official levels with the paper's Matthew Rosenberg, "was the United States."

When Iran pays off Karzai, it's disruptive foreign meddling. But when the CIA does it, it's supposed to be an insurance policy to entrench U.S. influence in the president's office. Alas, there's something more important than influence in geopolitics: leverage. When Washington most needed leverage with Karzai, it didn't have much – at least not that it was prepared to use – and the CIA ghost money helps explain why.

Consider some of the U.S.' goals in Afghanistan over the past several years. (Put aside whether you think they're smart or stupid.) In 2009, the Obama administration began pressing Karzai to clean up his kleptocratic government and expand its institutional capacity to provide services to a dispersed population. Where once the U.S. hugged Karzai close and publicly praised him, diplomats and top officials began talking more about free and fair presidential elections. During that election season, someone decided to let slip that Karzai's brother was on the CIA payroll.

Ultimately, Karzai won the race under dubious circumstances, now with the backdrop of a frosty diplomatic relationship with Washington. The general in charge of the war effort, Stanley McChrystal, has written about how he buttered Karzai up in order to keep Karzai on board with U.S. war aims, which involved Karzai displaying competent and energetic governance. The U.S. ambassador in Kabul, Karl Eikenberry, saw the bigger picture. Karzai is "not an adequate strategic partner," Eikenberry cabled home. "He and much of his circle do not want the U.S. to leave and are only too happy to see us invest further."

Of course he wanted the U.S. to stay. The CIA, it now turns out, was his meal ticket. While it's surely a mistake to presume Karzai is only motivated by money – human beings are more complex than that – whenever the U.S. came calling about reform, Karzai has always been able to nod politely, secure in the knowledge the CIA bag man will still make his rounds. Perversely, the money removes U.S. leverage over Karzai: the Afghan president is free to demand an end to U.S. night raids and air strikes or to denounce America or to claim that the Taliban kill Afghan civilians at America's behest. If the secret money keeps flowing and the U.S. goes along with his reelection, Karzai is free to pursue his agenda, not Washington's, defeating the purpose of the payments while undermining the public aspects of U.S. policy in Afghanistan.

Paying off foreign leaders doesn't always fail. Sometimes it's expedient for an immediate goal, as when the CIA rented the anti-Taliban opposition in 2001 to gain a network of local fighters. And bribery can be an insurance policy for a broader goal, as with the U.S. arms purchases to Mubarak-era Egypt to secure the peace with Israel.

But just as foreign aid distorts a local economy and prompts corruption, so too does attempting to purchase a foreign leader. The CIA has learned this again and again: Mobuto Sese Seko in Zaire/Congo; Nguyen Van Thieu in South Vietnam; Jomo Kenyatta in Kenya. Shortcutting the arduous work of foreign policy through cash payments rarely works as intended: at best, it can paper over deeper dysfunctions for a time, as with Hosni Mubarak in Egypt or with Pakistan's duplicitous intelligence service. But over the long term, it ends up leaving the client in a stronger position than the patron, since the patron is rarely willing to walk away from the messy foreign entanglement that prompted the payout in the first place.

Worst of all is when U.S. policy is schizophrenic. The U.S. didn't want to rely on Karzai as the indispensable force in Afghan politics – that's why it briefly tried, around 2009-11, to build governance in the hinterlands – but paying Karzai encourages him to consolidate his power. The U.S. didn't want to create a "Central Asian Valhalla" in Afghanistan, as a former defense chief memorably put it, but it came to call corruption the biggest threat to the entire war effort while funneling money straight into Karzai's pockets.

Eikenberry saw all this in 2009 and warned Washington to use its real leverage – its military that stood between Karzai and death – and scale back the war, not escalate it. Eikenberry lost that debate.

When the history of the Afghanistan war is written, it may turn out to be three histories: the military's history, the CIA's history, and the broader diplomatic history that never took control of the other two. Karzai can't be faulted for taking the money that the CIA (and Iran) were just handing him. He should instead be the cautionary tale for the next time the CIA starts stuffing stacks inside backpacks.