In the tumultuous days leading up to the Pakistan Army’s ground offensive in the tribal area of South Waziristan, which began on October 17th, the Pakistani Taliban attacked what should have been some of the country’s best-guarded targets. In the most brazen strike, ten gunmen penetrated the Army’s main headquarters, in Rawalpindi, instigating a twenty-two-hour standoff that left twenty-three dead and the military thoroughly embarrassed. The terrorists had been dressed in Army uniforms. There were also attacks on police installations in Peshawar and Lahore, and, once the offensive began, an Army general was shot dead by gunmen on motorcycles on the streets of Islamabad, the capital. The assassins clearly had advance knowledge of the general’s route, indicating that they had contacts and allies inside the security forces.

Pakistan has been a nuclear power for two decades, and has an estimated eighty to a hundred warheads, scattered in facilities around the country. The success of the latest attacks raised an obvious question: Are the bombs safe? Asked this question the day after the Rawalpindi raid, Secretary of State Hillary Clinton said, “We have confidence in the Pakistani government and the military’s control over nuclear weapons.” Clinton—whose own visit to Pakistan, two weeks later, would be disrupted by more terrorist bombs—added that, despite the attacks by the Taliban, “we see no evidence that they are going to take over the state.”

Clinton’s words sounded reassuring, and several current and former officials also said in interviews that the Pakistan Army was in full control of the nuclear arsenal. But the Taliban overrunning Islamabad is not the only, or even the greatest, concern. The principal fear is mutiny—that extremists inside the Pakistani military might stage a coup, take control of some nuclear assets, or even divert a warhead.

On April 29th, President Obama was asked at a news conference whether he could reassure the American people that Pakistan’s nuclear arsenal could be kept away from terrorists. Obama’s answer remains the clearest delineation of the Administration’s public posture. He was, he said, “gravely concerned” about the fragility of the civilian government of President Asif Ali Zardari. “Their biggest threat right now comes internally,” Obama said. “We have huge . . . national-security interests in making sure that Pakistan is stable and that you don’t end up having a nuclear-armed militant state.” The United States, he said, could “make sure that Pakistan’s nuclear arsenal is secure—primarily, initially, because the Pakistan Army, I think, recognizes the hazards of those weapons’ falling into the wrong hands.”

The questioner, Chuck Todd, of NBC, began asking whether the American military could, if necessary, move in and secure Pakistan’s bombs. Obama did not let Todd finish. “I’m not going to engage in hypotheticals of that sort,” he said. “I feel confident that the nuclear arsenal will remain out of militant hands. O.K.?”

Obama did not say so, but current and former officials said in interviews in Washington and Pakistan that his Administration has been negotiating highly sensitive understandings with the Pakistani military. These would allow specially trained American units to provide added security for the Pakistani arsenal in case of a crisis. At the same time, the Pakistani military would be given money to equip and train Pakistani soldiers and to improve their housing and facilities—goals that General Ashfaq Parvez Kayani, the chief of the Pakistan Army, has long desired. In June, Congress approved a four-hundred-million-dollar request for what the Administration called the Pakistan Counterinsurgency Capability Fund, providing immediate assistance to the Pakistan Army for equipment, training, and “renovation and construction.”

The secrecy surrounding the understandings was important because there is growing antipathy toward America in Pakistan, as well as a history of distrust. Many Pakistanis believe that America’s true goal is not to keep their weapons safe but to diminish or destroy the Pakistani nuclear complex. The arsenal is a source of great pride among Pakistanis, who view the weapons as symbols of their nation’s status and as an essential deterrent against an attack by India. (India’s first nuclear test took place in 1974, Pakistan’s in 1998.)

A senior Pakistani official who has close ties to Zardari exploded with anger during an interview when the subject turned to the American demands for more information about the arsenal. After the September 11th attacks, he said, there had been an understanding between the Bush Administration and then President Pervez Musharraf “over what Pakistan had and did not have.” Today, he said, “you’d like control of our day-to-day deployment. But why should we give it to you? Even if there was a military coup d’état in Pakistan, no one is going to give up total control of our nuclear weapons. Never. Why are you not afraid of India’s nuclear weapons?” the official asked. “Because India is your friend, and the longtime policies of America and India converge. Between you and the Indians, you will fuck us in every way. The truth is that our weapons are less of a problem for the Obama Administration than finding a respectable way out of Afghanistan.”

The ongoing consultation on nuclear security between Washington and Islamabad intensified after the announcement in March of President Obama’s so-called Af-Pak policy, which called upon the Pakistan Army to take more aggressive action against Taliban enclaves inside Pakistan. I was told that the understandings on nuclear coöperation benefitted from the increasingly close relationship between Admiral Michael Mullen, the chairman of the Joint Chiefs of Staff, and General Kayani, his counterpart, although the C.I.A. and the Departments of Defense, State, and Energy have also been involved. (All three departments declined to comment for this article. The national-security council and the C.I.A. denied that there were any agreements in place.)

In response to a series of questions, Admiral Mullen acknowledged that he and Kayani were, in his spokesman’s words, “very close.” The spokesman said that Mullen is deeply involved in day-to-day Pakistani developments and “is almost an action officer for all things Pakistan.” But he denied that he and Kayani, or their staffs, had reached an understanding about the availability of American forces in case of mutiny or a terrorist threat to a nuclear facility. “To my knowledge, we have no military units, special forces or otherwise, involved in such an assignment,” Mullen said through his spokesman. The spokesman added that Mullen had not seen any evidence of growing fundamentalism inside the Pakistani military. In a news conference on May 4th, however, Mullen responded to a query about growing radicalism in Pakistan by saying that “what has clearly happened over the [past] twelve months is the continual decline, gradual decline, in security.” The Admiral also spoke openly about the increased coöperation on nuclear security between the United States and Pakistan: “I know what we’ve done over the last three years, specifically to both invest, assist, and I’ve watched them improve their security fairly dramatically. . . . I’ve looked at this, you know, as hard as I can, over a period of time.” Seventeen days later, he told the Senate Foreign Relations Committee, “We have invested a significant amount of resources through the Department of Energy in the last several years” to help Pakistan improve the controls on its arsenal. “They still have to improve them,” he said.

In interviews in Pakistan, I obtained confirmation that there were continuing conversations with the United States on nuclear-security plans—as well as evidence that the Pakistani leadership put much less weight on them than the Americans did. In some cases, Pakistani officials spoke of the talks principally as a means of placating anxious American politicians. “You needed it,” a senior Pakistani official, who said that he had been briefed on the nuclear issue, told me. His tone was caustic. “We have twenty thousand people working in the nuclear-weapons industry in Pakistan, and here is this American view that Pakistan is bound to fail.” The official added, “The Americans are saying, ‘We want to help protect your weapons.’ We say, ‘Fine. Tell us what you can do for us.’ It’s part of a quid pro quo. You say, also, ‘Come clean on the nuclear program and we’ll insure that India doesn’t put pressure on it.’ So we say, ‘O.K.’ ”

But, the Pakistani official said, “both sides are lying to each other.” The information that the Pakistanis handed over was not as complete as the Americans believed. “We haven’t told you anything that you don’t know,” he said. The Americans didn’t realize that Pakistan would never cede control of its arsenal: “If you try to take the weapons away, you will fail.”

High-level coöperation between Islamabad and Washington on the Pakistani nuclear arsenal began at least eight years ago. Former President Musharraf, when I interviewed him in London recently, acknowledged that his government had held extensive discussions with the Bush Administration after the September 11th attacks, and had given State Department nonproliferation experts insight into the command and control of the Pakistani arsenal and its on-site safety and security procedures. Musharraf also confirmed that Pakistan had constructed a huge tunnel system for the transport and storage of nuclear weaponry. “The tunnels are so deep that a nuclear attack will not touch them,” Musharraf told me, with obvious pride. The tunnels would make it impossible for the American intelligence community—“Big Uncle,” as a Pakistani nuclear-weapons expert called it—to monitor the movements of nuclear components by satellite.

Safeguards have been built into the system. Pakistani nuclear doctrine calls for the warheads (containing an enriched radioactive core) and their triggers (sophisticated devices containing highly explosive lenses, detonators, and krytrons) to be stored separately from each other and from their delivery devices (missiles or aircraft). The goal is to insure that no one can launch a warhead—in the heat of a showdown with India, for example—without pausing to put it together. Final authority to order a nuclear strike requires consensus within Pakistan’s ten-member National Command Authority, with the chairman—by statute, President Zardari—casting the deciding vote.

But the safeguards meant to keep a confrontation with India from escalating too quickly could make the arsenal more vulnerable to terrorists. Nuclear-security experts have war-gamed the process and concluded that the triggers and other elements are most exposed when they are being moved and reassembled—at those moments there would be fewer barriers between an outside group and the bomb. A consultant to the intelligence community said that in one war-gamed scenario disaffected members of the Pakistani military could instigate a terrorist attack inside India, and that the ensuing crisis would give them “a chance to pick up bombs and triggers—in the name of protecting the assets from extremists.”

The triggers are a key element in American contingency plans. An American former senior intelligence official said that a team that has trained for years to remove or dismantle parts of the Pakistani arsenal has now been augmented by a unit of the Joint Special Operations Command (JSOC), the élite counterterrorism group. He added that the unit, which had earlier focussed on the warheads’ cores, has begun to concentrate on evacuating the triggers, which have no radioactive material and are thus much easier to handle.

“The Pakistanis gave us a virtual look at the number of warheads, some of their locations, and their command-and-control system,” the former senior intelligence official told me. “We saw their target list and their mobilization plans. We got their security plans, so we could augment them in case of a breach of security,” he said. “We’re there to help the Pakistanis, but we’re also there to extend our own axis of security to their nuclear stockpile.” The detailed American planning even includes an estimate of how many nuclear triggers could be placed inside a C-17 cargo plane, the former official said, and where the triggers could be sequestered. Admiral Mullen, asked about increased American insight into the arsenal, said, through his spokesman, “I am not aware of our receipt of any such information.” (A senior military officer added that the information, if it had been conveyed, would most likely “have gone to another government agency.”)