The man the United States has depended on for cooperation in fighting the militants and who holds most power in Pakistan, the head of the army, Gen. Parvez Ashfaq Kayani, ran the ISI from 2004 to 2007, a period from which many of the reports are drawn. American officials have frequently praised General Kayani for what they say are his efforts to purge the military of officers with ties to militants.

American officials have described Pakistan’s spy service as a rigidly hierarchical organization that has little tolerance for “rogue” activity. But Pakistani military officials give the spy service’s “S Wing” — which runs external operations against the Afghan government and India — broad autonomy, a buffer that allows top military officials deniability.