WASHINGTON—That Osama bin Laden chose as a refuge a scenic summer resort in Pakistan, a country where he knew the United States had pretty much a free hand against al-Qaeda, says it all. We need not question the Pentagon or any other Western military establishment when they tell us that Pakistan’s Inter-Services Intelligence directorate is in cahoots with terrorism: All we need to do is understand that the most wanted man in the world trusted Pakistan enough to stay there in a highly visible compound, near a military academy, 35 miles from Islamabad.

Cynics will be tempted to think that Pakistan’s highest authorities, perhaps even President Asif Ali Zardari, gave al-Qaeda’s boss safe haven, or at least failed to act on information that must have crossed their path. But they will be wrong. If Pakistan’s complicity with al-Qaeda had been a policy implemented from the top, it would have been easily neutralized long ago and Pakistan would be a very different political animal than it is. No, this was never the problem—either with dictator Pervez Musharraf during most of the last decade or with his democratically elected successor. The fundamental flaw is that, unlike in the Arab world, where the military and Muslim fundamentalists have long been bitter enemies, in Pakistan the two have been intertwined since the times of dictator Mohammed Zia ul-Haq in the late 1970s and throughout the 1980s. The profound interconnection has become a permanent feature of Pakistan even as the top leadership of the country has come and gone.

The army used fundamentalism to legitimize its authoritarian rule just as it used the development of nuclear weapons to bolster national pride. The context of the Cold War, during which Pakistan’s militant Islam was directed against the Soviet occupation of Afghanistan, fueled the growth of religious fanaticism sanctified by government policy. The emergence of the Pakistan Muslim League, one of the more powerful civilian movements in the country, under military encouragement consolidated the marriage between fundamentalism and official institutions.

I have mentioned in past columns how obvious this was to anyone who spent a bit of time in Pakistan in the 1990s, as I did, after the Soviets had left neighboring Afghanistan. In Arab countries, the top leaders usually rely on the army to contain violent religious groups. In Pakistan, the civilian leadership, notably that of Benazir Bhutto, was essentially constrained by both the military establishment and Muslim fundamentalists. In times of military dictatorship, the guy at the top, willingly or unwillingly, worked within those parameters too. No force was able to dissolve this diabolic structure—not even the $20 billion the United States has poured into that country for counterterrorism purposes since 9/11.

This does not mean that everyone in the military is a fundamentalist, that everyone in government is a weakling or that the entire Inter-Services Intelligence directorate has been protecting bin Laden for 10 years. But the genuine efforts made by many Pakistani soldiers and civilians who have helped catch or kill important terrorist leaders and led an offensive against the enemy in various parts of the country are operating in an environment in which their ability to succeed is gravely compromised from within.

In July 2010, Secretary of State Hillary Clinton said, “I believe (bin Laden) is here in Pakistan.” In a later interview, she added: “We have been getting, with Pakistani cooperation, a lot of the top leadership of al-Qaeda. . . . I assume somebody in this government, from top to bottom, does know where bin Laden is.” She was expressing in a nutshell the decades-long problem with the Pakistani state. It is infinitely worse to have a government in which the leadership does not control vast segments of a rogue military establishment than one in which the top leadership controls a rogue state. In the first case, you are never sure who exactly is your enemy. In the second, things are clear.

That Islamabad took 11 hours to react to bin Laden’s death and that the first statement was not even from the president indicates what a huge embarrassment this is for Pakistan. But it also shows how insecure and powerless President Zardari feels now that the essential flaw of the state he supposedly runs has been exposed.

In many ways, getting bin Laden was the easy part. The really tough one is remaking the Pakistani state.