PESHAWAR, Pakistan — Half a dozen men sit on the floor in a grimy rented storefront in the crowded Khyber Bazaar. A bottle of locally brewed liquor chills in a water cooler in the corner, a Pepsi bottle next to it for mixing. A Bollywood soundtrack plays in the background. It’s a farewell party for Allah Noor, who has spent the last five years identifying targets in rural Pakistan for U.S. drone strikes.

Noor, as we’ll call him, is tall and wiry. Now in his early thirties, his cheeks are sunken from smoking too much hash. He hasn’t slept in the same place two nights in a row ever since a U.S. drone killed Maulvi Nazir, his former boss, on Jan. 2, 2013. “After that,” he says, “I realized the government is playing a double game.”

“Sometimes I hide in Karachi, or in Rawalpindi, or Hyderabad, or other places. Now I have a visa for the UAE, and I fly out at 9 a.m. tomorrow.” If he doesn’t escape Waziristan soon, there may be a price on Noor’s head.

There is a saying in North Waziristan: The people there are stuck “between drones in the sky, and daggers on the earth.”

Ever since jihadis set up shop in North Waziristan in 2001, the region has become a battleground for a war between Pakistan, Afghanistan, the United States, and a potpourri of groups with sometimes overlapping agendas. Some groups, like the one led by Maulvi Nazir, once had a truce with Pakistan, agreeing to focus on toppling the Afghan government and reestablishing Taliban rule there. Others, like the Tehrike e Taliban Pakistan (TTP) vowed to topple the Pakistani state itself. Hundreds, perhaps thousands, of foreign fighters—Arabs, Central Asians, even Chinese Uighurs—flocked to North Waziristan, each bringing his own global struggle with him.

In June, Pakistan launched an all-out military offensive in the region, ostensibly to evict all the militants from the area. The army claims to have killed more than a thousand. In the meantime, more than a million people fled the region.

Even before the current military operation though, Pakistan had more than 140,000 troops stationed in FATA, the Federally Administered Tribal Areas, including many in North Waziristan. It felt the impact of most of almost three quarters of the 387 drone strikes that have hit the country. The very fact that so many troops co-existed with so many militants meant some kind of complicated alliances were afoot.

Locals like Noor knew of those alliances firsthand.

The city of Miran Shah, for example, was subjected to a nighttime curfew for years. Pakistani helicopter gunships regularly struck targets in the countryside nearby, as American drones circled overhead taking out high-value targets. One drone fired missiles, while three others tracked the target. None of this would have been possible if Pakistan did not clear the airspace in North Waziristan. Pakistani troops even fought off militants attempting to reach the wreckage of drones that had crashed.

Pakistan’s civilian leadership regularly condemned the strikes, maintaining an implausible facade to pacify a populace that would never accept the kind of cooperation that was taking place between Pakistan and the United States.

“Both the government and military were complicit in allowing the drone attacks,” says Talat Masood, a retired Pakistani general and security expert. “They thought in their minds the drones had a tactical advantage, so they allowed them to continue for quite some time.”

The secret deals began in 2004, when Gen. Pervez Musharraf, then Pakistan’s dictator, asked the United States for a drone strike to take out Nek Muhammad, a Taliban commander battling his troops. In exchange, as Musharraf himself later admitted, the CIA could go after its own targets, too.

That cooperation continued after the restoration of democratic government, led by the Pakistan People’s Party, which came to power in 2008 on a wave of sympathy following the killing of its leader, Benazir Bhutto, by the Pakistani Taliban. In 2009, the Pakistani government asked the United States to kill Baitullah Mehsud, the group’s leader, who it believed had personally called for Bhutto’s assassination. It took dozens of tries, and the deaths of hundreds of people, but when Mehsud was finally killed, the CIA shared footage of the strike with Pakistan. Until 2011, the deputy director of the CIA delivered regular briefs to Pakistan’s ambassador in Washington, Hussain Haqqani, complete with before and after photos.

“A criminal is a criminal, whether he was killed by a drone or some other machine,” says Rehman Malik, who served as Pakistan’s interior minister from 2008 to 2012, although he insisted that, in principle, he was against the drone strikes. “The killing is a separate issue, and the violation of our sovereignty is a separate issue, one on which we will not compromise.” Malik admits Pakistan shared intelligence with the United States on high-value targets, intelligence that was later used in drone strikes.

It was men like Noor who actually gathered the intelligence.

Before Noor started spotting targets for drone strikes, he was a fighter with Maulvi Nazir’s faction of the Taliban. The group, which is based in South Waziristan, where Noor is from, fought in the insurgency in Afghanistan against the American occupation. Noor joined it in 2007 with the encouragement of a man he simply calls “Mr. Khattak.”

Noor heard that the man paid for information, and Noor needed money, so he sought him out in the bazaar of Wana, South Waziristan’s largest city. “Take this, enjoy yourself, and when you can, pay me back,” Mr. Khattak told Noor, handing him 10,000 rupees, or about $100.

Within a few weeks, Mr. Khattak had convinced Noor to join Maulvi Nazir’s fighters.

With the approval of the Pakistani military, Maulvi Nazir’s group soon turned on thousands of Uzbek fighters that had been their guests since 2001. The Uzbek fighters, whose loyalties lay with Al-Qaeda, had taken to attacking Pakistani military installations, and killing tribal elders.

Noor, who claims he killed 17 Uzbeks in the fighting himself, says the Pakistani army was helping him and other fighters, treating wounded at the government hospital in Wana, and allowing them through checkpoints. There was an understanding among fighters like Noor that the aims of the Pakistani military and Maulvi Nazir had aligned in this instance, and ridding South Waziristan of the Uzbeks would benefit both parties.

In March 2009, Mr. Khattak showed up again. “He was worried,” Noor remembers. “He said we need a person in the Taliban, someone who can work in North Waziristan.” The Uzbeks and other Central Asians had left the south, but many had found refuge in the north, in cities like Miran Shah.

Mr. Khattak took Noor to visit a Pakistani military camp in Wana, where he was invited to have tea with a man who identified himself as a subedar, a junior commissioned officer traditionally assigned to maintain an informant network for Pakistan’s military intelligence, the ISI, and the regular army. The subedar asked him for help in identifying and eliminating Uzbeks and other al Qaeda-linked fighters in North Waziristan. “It was like a curtain was beginning to be opened,” says Noor, who was surprised by the blunt request. “I realized the army was working with some of the Taliban.”

In late 2009, Noor was told to find a man called Mufti, who led a team of more than a dozen Central Asian jihadis, and lived in Hurmaz, a neighborhood in Mir Ali that locals called “Uzbekistan” because of hundreds of Uzbek fighters that made it their home.

On Jan. 7, Noor made the seven-hour trip to Mir Ali, where he stayed at the home of a friend in Hurmaz. Hoping Mufti would be some kind of devout Muslim, Noor began attending services at local mosques and seminaries, but found no sign of the man. It took him three weeks, but eventually he found Mufti’s home, and the location of a rented house in the nearby neighborhood of Musakki where Mufti held a meeting of his fighters every Thursday night.

Back in Wana, Noor drew Mr. Khattak a map of the area, and in February, a drone strike killed Mufti and an undetermined number of Uzbek fighters.

It was the first of many hits, a lucrative side project that earned Noor around $350 per target. But then things started going south. Al Qaeda pushed back.

As the American drone-strike program ramped up in 2009, al Qaeda put together an elite group of trusted jihadis who had a special mandate to track down and eliminate intelligence operatives working in the region, directly or indirectly, for the Americans. Ittihad e Mujahedeen e Khurasan, a group of about 250 armed fighters, most of them foreigners rather than Pakistanis, quickly became one of the most feared groups in North Waziristan. Within a few years, it had killed more than 300 suspected spies, brazenly kidnapping them in broad daylight, and releasing videos detailing the evidence against them after dumping their bodies. Khurasan’s logo is a knife below a severed head dripping blood. Its operatives drive a fleet of distinctive white sedans with tinted windows, their group’s name etched on the back windshield.

(The name Khurasan or Khorasan is a reference to the region of Iran, Afghanistan, and Pakistan at the time of the Prophet Mohammed. Fighters from there carrying black flags were supposed to have become the vanguard of an all-conquering jihad, and the name has been picked up as well by a group of al Qaeda operatives in Syria, some of whom may be veterans of Afghanistan and Pakistan.)

When the conflict between the army and militants in North Waziristan heated up earlier this year, tens of thousands of students from the region moved to Peshawar to enroll in schools there. The students brought with them videos showing what life was like in North Waziristan. Among them was a remarkable video documenting how Khurasan eliminated a network of six informants, some of whom were working simultaneously for the Pakistani military, Afghan intelligence, and the U.S. drone program.

The informant network’s leader, Gul Abbas Khan, appears in the video, saying he regularly met Pakistani military officers and local administrative officials. The officials paid him to track down high-value targets, including Abu Yahya al Libi, al Qaeda’s second in command. A drone strike killed al Libi on June 4, 2012, near Mir Ali in North Waziristan. It was arguably the most important target the American drone program had ever taken out.

The intelligence that led to Libi’s death came down to a 17-year-old named Rehmanullah, who recounts how he found himself throwing a pathrai, a tiny electronic homing beacon used by drones, into a compound where the al Qaeda leader was staying.

Lured by the prospect of quick cash, Rehmanullah began working for Khan, despite the threat of being killed by the Taliban. “Gul Abbas Khan informed me that there are some foreigners close to my house and I have to keep eye on them,” recalls an ashen-faced Rehmanullah in the video, which runs nearly 45 minutes. “It was 9 p.m. when he [Khan] visited my house, this time he had a [Pakistani army] subedar with him. The subedar gave me a chip and made it clear how I should throw it on the targeted house.”

“At midnight I placed the chip in the house where foreigners were staying. I came back home after doing the job. The drone hit its target. It was so horrible and powerful that it damaged my house too.”

The strike killed between 10 and 16 people, according to research by the Bureau of Investigative Journalism and Amnesty International. An initial volley of missiles killed five people in the home, and 10 minutes later a second volley killed up to 11 rescuers. Rehmanullah says Khan gave him 20,000 rupees, about $200. He asked for more, but was told he would earn more with future jobs.

The video then cuts to Rehmanullah on the side of a road, hands tied and blindfolded, sitting on the ground, illuminated by a car’s headlights. A masked man walks up behind him and shoots him in the back of the head, then pumps more bullets into his body as it slumps on the ground.

Khurasan’s cars pull up in North Waziristan’s bazaars in broad daylight, operatives fanning out to set up checkpoints. Every car passenger and pedestrian is checked, one by one, until the operatives find their target. “If you see their car, you know some poor soul is about to die,” Noor says, at his farewell party.

Khurasan’s counterintelligence campaign wreaked havoc on the informant network the United States and the Pakistani military used to track targets. In 2009, the Obama administration relaxed its rules for who could be targeted in FATA, including, apparently for the first time, “signature strikes,” targeting groups of men who were behaving like militants, even if there was no intelligence on the presence of any specific high-value target.

If on the ground Noor found himself in the crosshairs of Khurasan, he could at least have some assurance that Pakistani intelligence would not be helping CIA drone operatives track him or his boss, Maulvi Nazir. Since 2007, Maulvi Nazir and the Pakistani military had kept to an unwritten truce. On several occasions, Pakistani officials tipped off Maulvi Nazir and his men about impending drone strikes.

But that friendship vanished by 2012, as Pakistan got word Maulvi Nazir was planning to join the TTP, and pressure from the U.S. to crack down on local support for the Afghan insurgency intensified. Whatever protection the Pakistanis had been giving to Maulvi Nazir was no longer on the table.

On Jan. 2, 2013, an Afghan national handed Maulvi Nazir a digital Quran reader during a visit to Afghanistan’s Paktika province, just across the border from South Waziristan’s Angoor Adda area. Inside was a homing chip. As soon as he crossed back into Pakistan, a U.S. drone struck the vehicle carrying Maulvi Nazir and at least five of his commanders.

With the death of his boss, Noor decided it was time to quit. He wasn’t willing to risk his life in the face of Ittihad e Mujahedeen e Khurasan’s balaclava-wearing operatives, and went into hiding.

Noor realized the next drone strike could target him.