It’s the end of the Second World War, and the United States is deciding what to do about two immense, poor, densely populated countries in Asia. America chooses one of the countries, becoming its benefactor. Over the decades, it pours billions of dollars into that country’s economy, training and equipping its military and its intelligence services. The stated goal is to create a reliable ally with strong institutions and a modern, vigorous democracy. The other country, meanwhile, is spurned because it forges alliances with America’s enemies.

The Afghan warlord Jalaluddin Haqqani, an ally of Osama bin Laden, in 1991. Photographs by Robert Nickelsberg

The country not chosen was India, which “tilted” toward the Soviet Union during the Cold War. Pakistan became America’s protégé, firmly supporting its fight to contain Communism. The benefits that Pakistan accrued from this relationship were quickly apparent: in the nineteen-sixties, its economy was an exemplar. India, by contrast, was a byword for basket case. Fifty years then went by. What was the result of this social experiment?

India has become the state that we tried to create in Pakistan. It is a rising economic star, militarily powerful and democratic, and it shares American interests. Pakistan, however, is one of the most anti-American countries in the world, and a covert sponsor of terrorism. Politically and economically, it verges on being a failed state. And, despite Pakistani avowals to the contrary, America’s worst enemy, Osama bin Laden, had been hiding there for years—in strikingly comfortable circumstances—before U.S. commandos finally tracked him down and killed him, on May 2nd.

American aid is hardly the only factor that led these two countries to such disparate outcomes. But, at this pivotal moment, it would be a mistake not to examine the degree to which U.S. dollars have undermined our strategic relationship with Pakistan—and created monstrous contradictions within Pakistan itself.

American money began flowing into Pakistan in 1954, when a mutual defense agreement was signed. During the next decade, nearly two and a half billion dollars in economic assistance, and seven hundred million in military aid, went to Pakistan. After the 1965 Pakistan-India war began, the U.S. essentially withdrew aid to both countries. Gradually, U.S. economic aid was restored, but the Pakistani military was kept on probation.

Those civilian-aid programs were largely successful. Christine Fair, a specialist on South Asia at the Center for Peace and Security Studies, at Georgetown University, notes that the original model for economic assistance was “demand driven”—local groups or governments proposed projects and applied for grants. Aid usually came in the form of matching funds, so that grantees had a stake in the projects. Moreover, American specialists presided over the disbursement of these funds and served as managers. “That was effective,” Fair says. “But we haven’t done it for decades.”

Then, in 1979, U.S. intelligence discovered that Pakistan was secretly building a uranium-enrichment facility in response to India’s nuclear-weapons program. That April, the military dictator of Pakistan, General Mohammed Zia-ul-Haq, hanged the civilian President he had expelled from office, Zulfikar Ali Bhutto; he then cancelled elections. U.S. aid came to a halt. At the same time, Zia began giving support to an Islamist organization, Jamaat-e-Islami, the forerunner of many more radical groups to come. In November, a mob of Jamaat followers, inflamed by a rumor that the U.S. and Israel were behind an attack on the Grand Mosque, in Mecca, burned the U.S. Embassy in Islamabad to the ground, killing two Americans and two Pakistani employees. The American romance with Pakistan was over, but the marriage was just about to begin.

The very next month, the Soviet Union invaded Afghanistan. President Jimmy Carter, in a panic, offered Zia four hundred million dollars in economic and military aid. Zia rejected the offer, calling it “peanuts”—the term often arises in Pakistani critiques of American aid, but it must have rankled the peanut farmer in the White House. Zia was smart to hold out. Under Carter’s successor, Ronald Reagan, U.S. aid nearly quintupled: about three billion dollars in economic assistance and two billion in military aid. The Reagan Administration also provided three billion dollars to Afghan jihadis. These funds went through the sticky hands of the Inter-Services Intelligence directorate, the spy branch of the Pakistani Army. Starting in 1987, the I.S.I. was headed by General Hamid Gul, a cunning and bitterly anti-American figure. The I.S.I. became so glutted with power and money that it formed a “state within a state,” in the words of Benazir Bhutto, who became Pakistan’s Prime Minister in 1988. She eventually fired Gul, fearing that he was engineering a coup.

Milton Bearden, a former C.I.A. station chief in Pakistan, once described Gul to me as having a “rococo” personality. In 2004, I visited Gul—a short man with a rigid, military posture and raptor-like features—at his villa in Rawalpindi. He proudly asked his servant to bring me an orange from his private grove. I asked Gul why, during the Afghan jihad, he had favored Gulbuddin Hekmatyar, one of the seven warlords who had been designated to receive American assistance in the fight against the Soviets. Hekmatyar was the most brutal member of the group, but, crucially, he was a Pashtun, like Gul. As I ate the orange, Gul offered a more principled rationale for his choice: “I went to each of the seven, you see, and I asked them, ‘I know you are the strongest, but who is No. 2?’ ” He formed a tight, smug smile. “They all said Hekmatyar.”

Later, Gul helped oversee the creation of the Taliban, reportedly using mainly Saudi money. The I.S.I. openly supported the Taliban until September 11, 2001. Since then, the Pakistani government has disavowed the group, but it is widely believed that it still provides Taliban leaders with safe harbor in Quetta, where they stage jihad against Western forces in Afghanistan.

In 1990, President George H. W. Bush cut off military aid to Pakistan. Ostensibly, this was in response to Pakistan’s pursuit of nuclear weapons, but it’s also true that, after the Soviets were pushed out of Afghanistan, in the late eighties, the U.S. lost interest in Pakistan. U.S. assistance, directed almost entirely toward food and counter-narcotics efforts, fell to forty-five million dollars a year, and declined further after 1998, when Pakistan began testing nuclear weapons.

After the September 11th attacks, Pakistan abruptly became America’s key ally in the “war on terror.” Under President George W. Bush, the U.S. gave billions of dollars to Pakistan, most of it in unrestricted funds, to combat terrorism. Pervez Musharraf, who served as President between 1999 and 2008, now admits that during his tenure he diverted many of those billions to arm Pakistan against its hobgoblin enemy, India. “Whoever wishes to be angry, let them be angry—why should we bother?” Musharraf said in an interview on the Pakistani television channel Express News. “We have to maintain our security.” Since Musharraf left office, there has been little indication that U.S. aid—$4.5 billion in 2010, one of the largest amounts ever given to a foreign country—is being more properly spent.

The main beneficiary of U.S. money, the Pakistani military, has never won a war, but, according to “Military Inc.,” by Ayesha Siddiqa, it has done very well in its investments: hotels, real estate, shopping malls. Such entrepreneurship, however corrupt, fills a gap, as Pakistan’s economy is now almost entirely dependent on American taxpayers. In a country of a hundred and eighty million people, fewer than two million citizens pay taxes, and Pakistan’s leaders are doing little to change the situation. In Karachi, the financial capital, the government recently inaugurated a program to appoint eunuchs as tax collectors. Eunuchs are considered relentless scolds in South Asia, and the threat of being hounded by one is somehow supposed to take the place of audits.

In 2008, Pakistan’s government made the dramatic announcement that it was placing the I.S.I. under the control of its Interior Ministry—a restructuring that was revoked within hours by inflamed military leaders, who effectively vetoed the government. That November, Lashkar-e-Taiba, a terrorist organization that has reportedly received backing from the I.S.I. to wage jihad in Kashmir, carried out attacks on tourists in Mumbai. According to American indictments, an I.S.I. officer directed the surveillance of suitable targets. Those sites included the Taj and Oberoi hotels, the train station, the Leopold Café, and the Chabad House, a Lubavitch outpost run by an American rabbi and his pregnant wife. According to Sebastian Rotella, who has written extensively for ProPublica about the attack, “They were going out of their way to kill Americans.” At the hotels, the attackers sorted through passports, looking for American and British citizens. In the end, a hundred and sixty-six people were killed, but only six were Americans. The Pakistani government denied any involvement, although it eventually conceded that the attacks had been planned in Pakistan.

Ali Soufan, a former F.B.I. special agent who interrogated many of the Al Qaeda members captured in Pakistan, told me that “the majority of them said that Lashkar-e-Taiba had given them shelter.” After the battle of Tora Bora, he added, the Al Qaeda members who fled to Pakistan—including top leaders—were greeted by Lashkar operatives and taken to safe houses. Some Pakistanis worry that Lashkar may become the new Al Qaeda.

Pashtun refugees from the Soviet-Afghan war at a camp in northern Pakistan, in 1990.

In 2009, Senators Richard Lugar and John Kerry, recognizing that American military aid had given the Army and the I.S.I. disproportionate power in Pakistan, helped pass legislation in Congress sanctioning seven and a half billion dollars in civilian assistance, to be disbursed over a period of five years. Pakistan’s Foreign Minister, Shah Mehmood Qureshi, apparently at the direction of the military, flew to Washington, and insisted that his country would not be micromanaged. So far, less than a hundred and eighty million dollars of that money has been spent, because the civilian projects require oversight and checks on corruption. The Pakistani military, meanwhile, submits expense claims every month to the U.S. Embassy in Islamabad; according to a report in the Guardian, receipts are not provided—or requested.

One day in March, 2004, when I was in Peshawar, in northern Pakistan, a firefight broke out in the tribal areas nearby. The newspapers said the Army was fighting Al Qaeda, and had surrounded Ayman al-Zawahiri, bin Laden’s deputy. Zawahiri escaped, but the troops captured a number of Al Qaeda fighters, including Zawahiri’s son Ahmed. The next day, a newspaper bore the headline “AHMED’S TALKING!” Yet Zawahiri doesn’t have a son named Ahmed. After that day, nothing more was said about Ahmed, but I kept puzzling over that tricked-up episode. I began to wonder, What would happen if the Pakistani military actually captured or killed Al Qaeda’s top leaders? The great flow of dollars would stop, just as it had in Afghanistan after the Soviets limped away. I realized that, despite all the suffering the war on terror had brought to Pakistan, the military was addicted to the money it generated. The Pakistani Army and the I.S.I. were in the looking-for-bin-Laden business, and if they found him they’d be out of business.

A number of investigative reports have suggested that the I.S.I. diverted American money designated for fighting terrorism to the Taliban. According to a 2007 document released by WikiLeaks, U.S. military interrogators at Guantánamo implicitly acknowledged this problem when they placed the I.S.I. on an internal list of “terrorist and terrorist-support entities.”

In October, 2009, I went to Washington to attend a daylong conference on “Al Qaeda and Its Allies.” (The event was sponsored by the New America Foundation and by the Center on Law and Security, at N.Y.U.’s law school, where I am a fellow.) The final panel discussion was devoted to Pakistan. Major General Mahmud Ali Durrani, a former Pakistani Ambassador to the U.S., spoke of the importance of having America and Pakistan united in their military strategy, especially in South Waziristan, which he called “the epicenter of militancy.” The halfhearted efforts of the Pakistani Army to oppose its radical protégés there had created a ferocious backlash. The Taliban attacked I.S.I. offices and began taking over parts of Pakistani territory, including the Swat Valley, which is less than a hundred miles from Islamabad. Just two weeks before the conference, a group of Taliban fighters attacked the military headquarters in Rawalpindi, a mile from where General Durrani lives. The I.S.I. had lost control of its creation.

Durrani made a plea for the U.S. to continue its partnership with Pakistan. “Trust us, developing Pakistan’s capacity to fight terrorism will pay rich dividends,” he said. “I do not want to sound ungrateful, but what had been supplied over the last five years, in terms of hardware, is almost peanuts.” When I had the opportunity to ask a question, I pointed out that, since 9/11, the U.S. had given eleven billion dollars to Pakistan, the bulk of it in military aid, much of which was misappropriated to buy weapons to defend against India. If Pakistan didn’t have the equipment to fight insurgents and terrorists in the tribal areas, was that really America’s fault? And if American aid to Pakistan—especially military assistance—had done more harm than good, shouldn’t it be drastically reduced?

Another retired general on the podium, Talat Masood, responded that the losses Pakistan had suffered in the “so-called war on terror” amounted to more than forty billion dollars. “So please don’t harp on the eleven billion,” he said.

Pakistan has indeed suffered for its official alliance with the U.S. In 2006, there were six suicide bombings in the country; the next year there were fifty-six, with six hundred and forty people killed. Last year, twelve hundred people were murdered by suicide bombers. More than three thousand Pakistani soldiers and officers have been killed in the war, including eighty-five members of the I.S.I. Yet many of these wounds have been self-inflicted, for the military and the I.S.I. created and nurtured the very groups—such as the Taliban—that have turned against the Pakistani state. And the money used to fund these radical organizations came largely from American taxpayers.

Many foreign-policy experts maintain that America cannot, at this juncture, cut off military aid to Pakistan—even if elements of the I.S.I. turn out to have harbored bin Laden. There are two prongs to this argument. One is that America needs Pakistan’s support in order to defeat the Taliban. If the U.S. withdraws aid, it is argued, Pakistan might insist that we can no longer fly drones over tribal areas. But Pakistan has covertly supported the drone program for years, in return for the U.S.’s targeting of Taliban forces that it cannot vanquish on its own. Without U.S. aid, the Pakistani military will need drone assistance more than ever.

The more pressing concern is that radical Islamists will somehow get their hands on a nuclear bomb, either through covert means or by actually coming to power. “The military is playing on this fear,” a Pakistani reporter, Pir Zubair Shah, told me.

As much as half of the money the U.S. gave to the I.S.I. to fight the Soviets was diverted to build nuclear weapons. The father of Pakistan’s bomb, A. Q. Khan, later sold plans and nuclear equipment to Libya, North Korea, and Iran. A month before 9/11, Pakistani nuclear scientists even opened a secret dialogue with Al Qaeda. The government of Pakistan has denied knowledge of what Khan and his associates were doing.

In February, 2009, the Pakistani government announced that it had “dismantled the nuclear black market network.” There is no way of knowing if this is true. Neither the U.S. nor the International Atomic Energy Agency has been allowed to interview Khan. According to a recent report by the Congressional Research Service, the “current status of Pakistan’s nuclear export network is unclear.” Meanwhile, American policymakers have been paralyzed by Pakistan’s nuclear capability. They have repeatedly expressed the worry that, if Pakistan is alienated, its nuclear secrets and materials might get into the wrong hands. But that has already happened.

Not only has American military aid been wasted, misused, and turned against us; it may well have undermined the Pakistani military, which has feasted on huge donations but is far weaker than its nemesis, the Indian military. If the measure of our aid is the gratitude of the Pakistani people and the loyalty of their government, then it has clearly been a failure. Last year, a Pew Research Center survey found that half of Pakistanis believe that the U.S. gives little or no assistance at all. Even the Finance Minister, Hafiz Shaikh, said last month that it was “largely a myth” that the U.S. had given tens of billions of dollars to Pakistan. And if the measure of our aid is Pakistan’s internal security, the program has fallen short in that respect as well. Pakistan is endangered not by India, as the government believes, but by the very radical movements that the military helped create to act as terrorist proxies.