Tensions between Islamabad and Washington have reached a fever pitch in recent months. As President Obama plans a visit for later this year to the world’s second-most-populous Muslim country, the White House wants above all else to fight Al Qaeda and wage its war in Afghanistan. Islamabad has something else in mind.

In January, the war strategy Obama announced more than two years ago was abruptly put in cold storage. After the American contractor Raymond Davis killed two Pakistanis on a street in Lahore and was then released in March after $2.3 million in compensation (so-called blood money) was paid to the victims’ families, the Pakistani public was more roiled than it has been in recent memory. The majority sentiment is that Pakistan’s national sovereignty comes under daily attack from U.S. drones and private contract operatives running around their country killing people. The Pakistani media fuels the anger, exerting untold amounts of energy on elaborate conspiracy theories about American spies sneaking around the country setting the stage for an American-Indian-Israeli master plan to steal Pakistan’s nuclear weapons.

Meanwhile, the Pakistani Army—which unquestionably remains the power behind the throne—has grown increasingly restive and angry with American intelligence work over the past two years. For the Army, blunders like the Davis case or operations like the drone strikes serve as incendiary daily reminders that full control of the country’s territory remains out of their grasp.

So what’s Pakistan’s solution? The leadership, including Chief of Army Staff Gen. Ashfaq Parvez Kayani and Director-General of the Inter-Services Intelligence Directorate (ISI) Lt. Gen. Ahmed Shuja Pasha, want a return to what they remember as “Reagan rules.”

These rules date back to the CIA-ISI relationship of the 1980s, when the agency and the Saudis provided the ISI with money and arms to underwrite the mujahedin’s battle against the Soviets in Afghanistan. Allies, indeed. But back in those days, Washington remained largely hands-off. They left the administration of the program and the running of the war to the ISI. The Americans had a very small footprint—fewer than 100 CIA officers ran the entire covert program in Washington, Islamabad, and Riyadh. In turn, there was rarely, if ever, a sense that Pakistani sovereignty or dignity was being challenged, much less violated. The ISI called the shots.

Reagan rules also included a tacit agreement that the U.S. would ignore Pakistan’s nuclear program. Every year the president certified to Congress that Pakistan’s nuclear efforts were “incomplete,” allowing U.S. assistance to continue to flow to Gen. Zia ul-Haq’s dictatorship. Only after the Soviets withdrew from Afghanistan in 1989 did the U.S. sanction Pakistan for their nuclear program. In 1990 Washington abruptly cut off the supply of F-16s and other weapons that Pakistan had already paid for. The Pakistani Army has never forgotten that betrayal.

The problem today is that we can’t go back to this Cold War world. The Pakistani Army and the ISI cannot be relied upon to fight all of the jihadi Frankensteins they have helped create over the past three decades. Even Pakistan’s own president, Asif Ali Zardari, has accused the Army of playing both sides of the war on terror—distressingly, an abundance of evidence backs him up. Take Lashkar-e-Taiba, the terror group that attacked the Indian financial capital of Mumbai in 2008, killing 164 people. Today, LeT continues to enjoy Army patronage. Pasha, the intelligence chief, has even been summoned by a New York City court to answer charges that the ISI oversaw the Mumbai attack.

Of course, Pakistan is also a victim of terror. Thousands of Pakistanis have died in suicide bombings. Since January, two senior civilian officials—the governor of Punjab and the minister for minority affairs—have been murdered by jihadi extremists. According to the United Nations, late Pakistani president Benazir Bhutto, Zardari’s wife, was assassinated by Al Qaeda. And Pakistan, more than any other country in the world, has been crucial to the capture of senior Qaeda operatives, including 9/11 mastermind Khalid Sheikh Mohammed. Irrefutable: Pakistan has more troops deployed fighting jihadi militants on the Afghan border than NATO has in all of Afghanistan.

The complexity and contradictions of Pakistani behavior—most of which is driven by the Army’s obsession with India, actually—lies at the heart of the dispute between Islamabad and Washington. There is no simple solution.

Should things go further south, though, there is only one real winner: Al Qaeda. If drone operations slow and the two intel agencies clam up, Obama’s goal to “disrupt, dismantle, and defeat Al Qaeda” will become an ever-more-distant possibility.

Since Pakistan today has the fastest-growing nuclear arsenal in the world—soon to be the fifth largest, just behind the U.S., Russia, China, and France—Islamabad is growing more and more resistant to outside pressure and intimidation. Unlike Afghanistan, Iraq, or Libya, the U.S. cannot even consider the use of force to pressure Pakistan, a fact of which Kayani is very well aware. Not to mention, Pakistan controls the main supply line for NATO forces from Karachi to Kabul in Afghanistan. Whenever U.S. Special Forces in Afghanistan have strayed across the border to chase terrorists, Pakistan twists a tourniquet on the supply chain.

So at the end of the day, Washington knows it needs Pakistan, no matter how frustrating and irritating the relationship may be. Meanwhile, India, the target of most of the worst of Pakistani-abetted terror and the target for its nuclear weapons, finds itself in much the same dilemma. It demands Pakistan destroy Lashkar-e-Taiba and other militant groups, but it has no means to force Islamabad to do so. It doesn’t want a failed state on its border armed with dozens of loose nukes, so it can’t undermine Pakistan’s fragile democracy with covert operations that would only strengthen the extremists. It can’t intimidate a nuclear rival. So India last month resumed its engagement and dialogue with Pakistan, which had been suspended after the Mumbai attacks. Prime Minister Manmohan Singh acknowledged that even a frustrating and deceitful dialogue is better than none. So he invited his counterpart to watch the semifinal of the Cricket World Cup.

The trick, for everyone involved, is to help strengthen those forces in Pakistan that want to get out of the endless rivalry with India. Then, end Pakistan’s dance with terror. For all his faults, Zardari is one of those who want a different approach. So, too, was Benazir. Both Singh and Obama understand this, too. Unfortunately the civilians and modernists are on the defensive in Islamabad today. In the short term the best help would be for outsiders to keep the footprint as light as possible. In the long term, however, it’s the India–Pakistan tensions that drive the most dangerous tendencies. The battle for the soul of this crucial nation between extremists and moderates is going poorly. We are the loser.