The burly American was escorted by Pakistani policemen into a crowded interrogation room. Amid a clatter of ringing mobile phones and cross talk among the cops speaking a mishmash of Urdu, Punjabi and English, the investigator tried to decipher the facts of the case.

“America, you from America?”

“Yes.”

“You’re from America, and you belong to the American Embassy?”

“Yes,” the American voice said loudly above the chatter. “My passport — at the site I showed the police officer. . . . It’s somewhere. It’s lost.”

On the jumpy video footage of the interrogation, he reached beneath his checkered flannel shirt and produced a jumble of identification badges hanging around his neck. “This is an old badge. This is Islamabad.” He showed the badge to the man across the desk and then flipped to a more recent one proving his employment in the American Consulate in Lahore.

“Consultant?” The man behind the desk paused for a moment and then shot a question in Urdu to another policeman. “And what’s the name?”

“Raymond Davis,” the officer responded.

“Raymond Davis,” the American confirmed. “Can I sit down?”

“Please do. Give you water?” the officer asked.

“Do you have a bottle? A bottle of water?” Davis asked.

Another officer in the room laughed. “You want water?” he asked. “No money, no water.”

Another policeman walked into the room and asked for an update. “Is he understanding everything? And he just killed two men?”

Hours earlier, Davis had been navigating dense traffic in Lahore, his thick frame wedged into the driver’s seat of a white Honda Civic. A city once ruled by Mughals, Sikhs and the British, Lahore is Pakistan’s cultural and intellectual capital, and for nearly a decade it had been on the fringes of America’s secret war in Pakistan. But the map of Islamic militancy inside Pakistan had been redrawn in recent years, and factions that once had little contact with one another had cemented new alliances in response to the C.I.A.’s drone campaign in the western mountains. Groups that had focused most of their energies dreaming up bloody attacks against India were now aligning themselves closer to Al Qaeda and other organizations with a thirst for global jihad. Some of these groups had deep roots in Lahore, which was why Davis and a C.I.A. team set up operations from a safe house in the city.

But now Davis was sitting in a Lahore police station, having shot two young men who approached his car on a black motorcycle, their guns drawn, at an intersection congested with cars, bicycles and rickshaws. Davis took his semiautomatic Glock pistol and shot through the windshield, shattering the glass and hitting one of the men numerous times. As the other man fled, Davis got out of his car and shot several rounds into his back.

He radioed the American Consulate for help, and within minutes a Toyota Land Cruiser was in sight, careering in the wrong direction down a one-way street. But the S.U.V. struck and killed a young Pakistani motorcyclist and then drove away. An assortment of bizarre paraphernalia was found, including a black mask, approximately 100 bullets and a piece of cloth bearing an American flag. The camera inside Davis’s car contained photos of Pakistani military installations, taken surreptitiously.

More than two years later, the Raymond Davis episode has been largely forgotten in the United States. It was immediately overshadowed by the dramatic raid months later that killed Osama bin Laden — consigned to a footnote in the doleful narrative of America’s relationship with Pakistan. But dozens of interviews conducted over several months, with government officials and intelligence officers in Pakistan and in the United States, tell a different story: that the real unraveling of the relationship was set off by the flurry of bullets Davis unleashed on the afternoon of Jan. 27, 2011, and exacerbated by a series of misguided decisions in the days and weeks that followed. In Pakistan, it is the Davis affair, more than the Bin Laden raid, that is still discussed in the country’s crowded bazaars and corridors of power.

Davis was taken to Kot Lakhpat prison, on the industrial fringes of Lahore, a jail with a reputation for inmates dying under murky circumstances. He was separated from the rest of the prisoners and held in a section of the decaying facility where the guards didn’t carry weapons, a concession for his safety that American officials managed to extract from the prison staff. The United States Consulate in Lahore had negotiated another safeguard: A small team of dogs was tasting Davis’s food, checking that it had not been laced with poison.

For many senior Pakistani spies, the man sitting in the jail cell represented solid proof of their suspicions that the C.I.A. had sent a vast secret army to Pakistan, men who sowed chaos and violence as part of the covert American war in the country. For the C.I.A., the eventual disclosure of Davis’s role with the agency shed an unflattering light on a post–Sept. 11 reality: that the C.I.A. had farmed out some of its most sensitive jobs to outside contractors — many of them with neither the experience nor the temperament to work in the war zones of the Islamic world.

The third child of a bricklayer and a cook, Davis grew up in a small clapboard house outside Big Stone Gap, a town of nearly 6,000 people in Virginia coal country. He became a football and wrestling star at the local high school, and after graduating in 1993, Davis enlisted in the Army and did a tour in Macedonia in 1994 as a United Nations peacekeeper. When his five-year hitch in the infantry was up, he re-enlisted, this time in the Army’s Third Special Forces Group based at Fort Bragg, N.C. He left the Army in 2003 and, like hundreds of other retired Navy SEALs and Green Berets, was hired by the private security firm Blackwater and soon found himself in Iraq working security for the C.I.A.

Little is known about his work for Blackwater, but by 2006, Davis had left the firm and, together with his wife, founded a security company in Las Vegas. Soon he was hired by the C.I.A. as a private contractor, what the agency calls a “Green Badge,” for the color of the identification cards that contractors show to enter C.I.A. headquarters at Langley. Like Davis, many of the contractors were hired to fill out the C.I.A.’s Global Response Staff — bodyguards who traveled to war zones to protect case officers, assess the security of potential meeting spots, even make initial contact with sources to ensure that case officers wouldn’t be walking into an ambush. Officers from the C.I.A.’s security branch came under withering fire on the roof of the agency’s base in Benghazi, Libya, last September. The demands of the wars in Iraq and Afghanistan had so stretched the C.I.A.’s own cadre of security officers that the agency was forced to pay inflated sums to private contractors to do the security jobs. When Davis first deployed with the C.I.A. to Pakistan in 2008, he worked from the agency’s base in Peshawar, earning upward of $200,000 a year.

Photo

Raymond Davis, who was employed by the C.I.A. as a contractor, was escorted out of court after facing a judge in Lahore, January 28, 2011.Credit
Tariq Saeed/Reuters

By mid-February 2011, with Davis still sitting in prison, anti-American passions were fully inflamed, and daily street protests and newspaper editorials demanded that the government not cave to Washington’s demands for Davis’s release but instead sentence him to death. The evidence at the time indicated that the men Davis killed had carried out a string of petty thefts that day, but there was an added problem: the third man killed by the unmarked American S.U.V. fleeing the scene. Making matters even worse for Davis was the fact that he was imprisoned in Lahore, where the family of Nawaz Sharif dominated the political culture. The former leader of the country made no secret about his intentions to once again run Pakistan, making him the chief antagonist to President Asif Ali Zardari and his political machine in Islamabad, a four-hour drive away. As the American Embassy in Islamabad leaned on Zardari’s government to get Davis released from jail, the diplomats soon realized that Zardari had little influence over the police officers and judges in the city of the president’s bitter rival.

But the most significant factor ensuring that Davis would languish in jail was that the Obama administration had yet to tell Pakistan’s government what the Pakistanis already suspected, and what Raymond Davis’s marksmanship made clear: He wasn’t just another paper-shuffling American diplomat. Davis’s work in Pakistan was much darker, and it involved probing an exposed nerve in the already-hypersensitive relationship between the C.I.A. and Pakistan’s military intelligence service, the Directorate for Inter-Services Intelligence, or I.S.I.

Ever since the Pakistani militant group Lashkar-e-Taiba (the Army of the Pure) dispatched teams of assassins to lay siege to luxury hotels and other sites in Mumbai, India, in November 2008, killing and wounding more than 500 people over four days of mayhem, C.I.A. analysts had been warning that the group was seeking to raise its global profile by carrying out spectacular attacks beyond South Asia. This spurred the agency to assign more of its expanding army of operatives in Pakistan toward gathering intelligence about Lashkar’s operations — a decision that put the interests of the C.I.A. and the I.S.I. in direct conflict. It was one thing for American spies to be lurking around the tribal areas, hunting for Al Qaeda figures; it was quite another to go into Pakistani cities on espionage missions against a group that the I.S.I. considered a valuable proxy force in its continuing battle with India.

The I.S.I. had nurtured the group for years as a useful asset against India, and Lashkar’s sprawling headquarters outside Lahore housed a radical madrassa, a market, a hospital, even a fish farm. The group’s charismatic leader, Hafiz Muhammad Saeed, had been put under house arrest at various times, but in 2009 the Lahore High Court quashed all terrorism charges against him and set him free. A stocky man with a wild beard, Saeed preached out in the open on many Fridays, flanked by bodyguards and delivering sermons to throngs of his followers about the imperialism of the United States, India and Israel. Even after the U.S. offered a $10 million reward for evidence linking Saeed to the Mumbai attacks, he continued to move freely in public, burnishing his legend as a Pakistani version of Robin Hood.

By the time Raymond Davis moved into a safe house with a handful of other C.I.A. officers and contractors in late 2010, the bulk of the agency’s officers in Lahore were focused on investigating the growth of Lashkar. To get more of its spies into Pakistan, the C.I.A. had exploited the arcane rules in place for approving visas for Americans. The State Department, the C.I.A. and the Pentagon all had separate channels to request visas for their personnel, and all of them led to the desk of Husain Haqqani, Pakistan’s pro-American ambassador in Washington. Haqqani had orders from Islamabad to be lenient in approving the visas, because many of the Americans coming to Pakistan were — at least officially — going to be administering millions of dollars in foreign-aid money. By the time of the Lahore killings, in early 2011, so many Americans were operating inside Pakistan under both legitimate and false identities that even the U.S. Embassy didn’t have accurate records of their identities and whereabouts.

The American Embassy in Islamabad is essentially a fortress within a fortress, a pile of buildings enclosed by walls topped with razor wire and surveillance cameras and then encircled by an outer ring of walls that separates a leafy area, called the Diplomatic Enclave, from the rest of the city. Inside the embassy, the work of diplomats and spies is kept largely separate, with the C.I.A. station occupying a warren of offices in its own wing, accessed only through doors with coded locks.

After Davis was picked up by the Lahore police, the embassy became a house divided by more than mere geography. Just days before the shootings, the C.I.A. sent a new station chief to Islamabad. Old-school and stubborn, the new chief did not come to Pakistan to be friendly with the I.S.I. Instead, he wanted to recruit more Pakistani agents to work for the C.I.A. under the I.S.I.’s nose, expand electronic surveillance of I.S.I. offices and share little information with Pakistani intelligence officers.

That hard-nosed attitude inevitably put him at odds with the American ambassador in Islamabad, Cameron Munter. A bookish career diplomat with a Ph.D. in history, Munter had ascended the ranks of the State Department’s bureaucracy and accepted several postings in Iraq before ultimately taking over the American mission in Islamabad, in late 2010. The job was considered one of the State Department’s most important and difficult assignments, and Munter had the burden of following Anne W. Patterson, an aggressive diplomat who, in the three years before Munter arrived, cultivated close ties to officials in the Bush and Obama administrations and won praise from the C.I.A. for her unflinching support for drone strikes in the tribal areas.

Munter saw some value to the drone program but was skeptical about the long-term benefits. Arriving in Islamabad at a time when relations between the United States and Pakistan were quickly deteriorating, Munter wondered whether the pace of the drone war might be undercutting relations with an important ally for the quick fix of killing midlevel terrorists. He would learn soon enough that his views about the drone program ultimately mattered little. In the Obama administration, when it came to questions about war and peace in Pakistan, it was what the C.I.A. believed that really counted.

With Davis sitting in prison, Munter argued that it was essential to go immediately to the head of the I.S.I. at the time, Lt. Gen. Ahmad Shuja Pasha, to cut a deal. The U.S. would admit that Davis was working for the C.I.A., and Davis would quietly be spirited out of the country, never to return again. But the C.I.A. objected. Davis had been spying on a militant group with extensive ties to the I.S.I., and the C.I.A. didn’t want to own up to it. Top C.I.A. officials worried that appealing for mercy from the I.S.I. might doom Davis. He could be killed in prison before the Obama administration could pressure Islamabad to release him on the grounds that he was a foreign diplomat with immunity from local laws — even those prohibiting murder. On the day of Davis’s arrest, the C.I.A. station chief told Munter that a decision had been made to stonewall the Pakistanis. Don’t cut a deal, he warned, adding, Pakistan is the enemy.

The strategy meant that American officials, from top to bottom, had to dissemble both in public and in private about what exactly Davis had been doing in the country. On Feb. 15, more than two weeks after the shootings, President Obama offered his first comments about the Davis affair. The matter was simple, Obama said in a news conference: Davis, “our diplomat in Pakistan,” should be immediately released under the “very simple principle” of diplomatic immunity. “If our diplomats are in another country,” said the president, “then they are not subject to that country’s local prosecution.”

Calling Davis a “diplomat” was, technically, accurate. He had been admitted into Pakistan on a diplomatic passport. But there was a dispute about whether his work in the Lahore Consulate, as opposed to the American Embassy in Islamabad, gave him full diplomatic immunity under the Vienna Convention on Diplomatic Relations. And after the shootings in Lahore, the Pakistanis were not exactly receptive to debating the finer points of international law. As they saw it, Davis was an American spy who had not been declared to the I.S.I. and whom C.I.A. officials still would not admit they controlled. General Pasha, the I.S.I. chief, spoke privately by phone and in person with Leon Panetta, then the director of the C.I.A., to get more information about the matter. He suspected that Davis was a C.I.A. employee and suggested to Panetta that the two spy agencies handle the matter quietly. Meeting with Panetta, he posed a direct question.

Was Davis working for the C.I.A.? Pasha asked. No, he’s not one of ours, Panetta replied. Panetta went on to say that the matter was out of his hands, and that the issue was being handled inside State Department channels. Pasha was furious, and he decided to leave Davis’s fate in the hands of the judges in Lahore. The United States had just lost its chance, he told others, to quickly end the dispute.

That the C.I.A. director would be overseeing a large clandestine network of American spies in Pakistan and then lie to the I.S.I. director about the extent of America’s secret war in the country showed just how much the relationship had unraveled since the days in 2002, when the I.S.I. teamed with the C.I.A. in Peshawar to hunt for Osama bin Laden in western Pakistan. Where had it gone so wrong?

While the spy agencies had had a fraught relationship since the beginning of the Afghan war, the first major breach came in July 2008, when C.I.A. officers in Islamabad paid a visit to Gen. Ashfaq Parvez Kayani, the Pakistani Army chief, to tell him that President Bush had signed off on a set of secret orders authorizing a new strategy in the drone wars. No longer would the C.I.A. give Pakistan advance warning before launching missiles from Predator or Reaper drones in the tribal areas. From that point on, the C.I.A. officers told Kayani, the C.I.A.’s killing campaign in Pakistan would be a unilateral war.

The decision had been made in Washington after months of wrenching debate about the growth of militancy in Pakistan’s tribal areas; a highly classified C.I.A. internal memo, dated May 1, 2007, concluded that Al Qaeda was at its most dangerous since 2001 because of the base of operations that militants had established in the tribal areas. That assessment became the cornerstone of a yearlong discussion about the Pakistan problem. Some experts in the State Department warned that expanding the C.I.A. war in Pakistan would further stoke anti-American anger on the streets and could push the country into chaos. But officials inside the C.I.A.’s Counterterrorism Center argued for escalating the drone campaign without the I.S.I.’s blessing. Since the first C.I.A. drone strike in Pakistan in 2004, only a small number of militants on the C.I.A.’s list of “high-value targets” had been killed by drone strikes, and other potential strikes were scuttled at the last minute because of delays in getting Pakistani approval, or because the targets seemed to have been tipped off and had fled.

So, in July 2008, when the C.I.A.’s director, Michael Hayden, and his deputy, Stephen Kappes, came to the White House to present the agency’s plan to wage a unilateral war in the mountains of Pakistan, it wasn’t a hard sell to a frustrated president. That began the relentless, years-long drone assault on the tribal areas that President Obama continued when he took office. And as the C.I.A.’s relationship with the I.S.I. soured, Langley sent station chiefs out to Islamabad who spent far less time and energy building up good will with Pakistani spies than their predecessors had. From 2008 on, the agency cycled a succession of seasoned case officers through Islamabad, and each left Pakistan more embittered than the last. One of them had to leave the country in haste when his identity was revealed in the Pakistani press. The C.I.A. suspected the leak came from the I.S.I.

Photo

Pakistani rage at the United States — in particular at the drone attacks in the tribal areas — found focus with the Raymond Davis affair.Credit
Ilyas J. Dean/PAK/Newscom

Even many of the operations that at first seemed likely to signal a new era of cooperation between the C.I.A. and the I.S.I. ended in recriminations and finger-pointing. In January 2010, a clandestine team of C.I.A. officers and American special-operations troops working in Karachi traced a cellphone to a house in Baldia Town, a slum in the western part of the sprawling city. The C.I.A. did not conduct unilateral operations inside large Pakistani cities, so the Americans notified the I.S.I. about the intelligence. Pakistani troops and policemen launched a surprise raid on the house.

Although the C.I.A. didn’t know in advance, hiding inside the house was Mullah Abdul Ghani Baradar, a man considered to be the Afghan Taliban’s military commander and the second in command to Mullah Muhammad Omar, the leader of the Taliban. Only after suspects in the house were arrested and questioned did the C.I.A. learn that Baradar was among the detainees. The I.S.I. took him to a detention facility in an industrial section of Islamabad and refused the C.I.A. access to him. “At that point, things got really complicated,” one former C.I.A. officer said.

Was the entire episode a setup? Rumors had circulated inside Pakistan that Baradar wanted to cut a deal with the Americans and bring the Taliban to the negotiating table in Afghanistan. Had the I.S.I. somehow engineered the entire arrest, feeding intelligence to the C.I.A. so that Baradar could be taken off the street and the nascent peace talks spoiled? Had the I.S.I. played the C.I.A.? Months later, senior C.I.A. officials at Langley still couldn’t answer those questions. Today, more than three years later, Mullah Baradar remains in Pakistani custody.

An error has occurred. Please try again later.

You are already subscribed to this email.

AsDavis languished in the jail cell in Lahore, the C.I.A. was pursuing its most promising lead about the whereabouts of Osama bin Laden since 2001, when he escaped from Tora Bora, in Afghanistan, and fled across the border into Pakistan. A small group of officers inside the agency’s Counterterrorism Center had become convinced that Bin Laden was hiding in a large compound in Abbottabad, a quiet hamlet north of Islamabad. For months, Panetta had been pushing clandestine officers to find a shred of hard proof that Bin Laden was hiding in the compound. The intelligence-gathering operating in Abbottabad had become the highest priority for the C.I.A. in Pakistan.

It was therefore more than a bit inconvenient that one of its undercover officers was sitting in a jail in Lahore facing a double murder charge. Pakistan’s Islamist parties organized street protests and threatened violent riots if Raymond Davis was not tried and hanged for his crimes. American diplomats in Lahore regularly visited Davis, but the Obama administration continued to stonewall Pakistan’s government about the nature of Davis’s work in the country.

And then the episode claimed another victim. On Feb. 6, the grieving widow of one of Davis’s victims swallowed a lethal amount of rat poison and was rushed to the hospital in Faisalabad, where doctors pumped her stomach. The woman, Shumaila Faheem, was certain that the United States and Pakistan would quietly broker a deal to release her husband’s killer from prison, a view she expressed to her doctors from her hospital bed. “They are already treating my husband’s murderer like a V.I.P. in police custody, and I am sure they will let him go because of international pressure,” she said. She died shortly afterward and instantly became a martyr for anti-American groups inside Pakistan.

The furor over the Davis incident was quickly escalating, threatening to shut down most C.I.A. operations in the country and derail the intelligence-gathering operation in Abbottabad. But the C.I.A. stood firm and sent top officials to Islamabad, who told Ambassador Munter to stick to the strategy.

By then, though, Munter had decided that the C.I.A.’s strategy wasn’t working, and eventually even high-level officials in the agency began to realize that stonewalling the Pakistanis was only causing the I.S.I. to dig in. After discussions among White House, State Department and C.I.A. officials in Washington, Munter approached General Pasha, the I.S.I. chief, and came clean. Davis was with the C.I.A., he said, and the United States needed to get him out of the country as quickly as possible. Pasha was fuming that Leon Panetta had lied to him, and he was going to make the Americans squirm by letting Davis sit in jail while he considered — on his own timetable — the best way to resolve the situation.

Back in Washington, Ambassador Haqqani was summoned to C.I.A. headquarters on Feb. 21 and taken into Panetta’s spacious office overlooking the agency’s campus in Langley, Va. Sitting around a large conference table, Panetta asked Haqqani for his help securing Davis’s release.

“If you’re going to send a Jason Bourne character to Pakistan, he should have the skills of a Jason Bourne to get away,” Haqqani shot back, according to one person who attended the meeting.

More than a week later, General Pasha came back to Ambassador Munter to discuss a new strategy. It was a solution based on an ancient tradition that would allow the matter to be settled outside the unpredictable court system. The issue had already been discussed among a number of Pakistani and American officials, including Ambassador Haqqani in Washington. The reckoning for Davis’s actions would come in the form of “blood money,” or diyat, a custom under Shariah law that compensates the families of victims for their dead relatives. The matter would be handled quietly, and Davis would be released from jail.

Pasha ordered I.S.I. operatives in Lahore to meet the families of the three men killed during the January episode and negotiate a settlement. Some of the relatives initially resisted, but the I.S.I. negotiators were not about to let the talks collapse. After weeks of discussions, the parties agreed on a total of 200 million Pakistani rupees, approximately $2.34 million, to offer “forgiveness” to the jailed C.I.A. officer.

Only a small group of Obama administration officials knew of the talks, and as they dragged on, Lahore’s high court was preparing to rule on whether Davis would be granted diplomatic immunity, a decision the C.I.A. expected to go against the United States and worried might set a precedent for future cases in Pakistan.

Davis remained in the dark about all of this. When he arrived for his court appearance on March 16, he was fully expecting to hear that the trial would proceed and that the judge would issue a new court date. He was escorted into the courtroom, his wrists cuffed in front of him, and locked inside an iron cage near the judge’s bench. According to one person’s account, General Pasha sat in the back of the courtroom, his cellphone out. He began sending out a stream of nervous text messages to Ambassador Munter, updating him about the court proceedings. Pasha was one of the most powerful men in Pakistan, and yet the I.S.I. had little control over the mercurial courts in Lahore, and he wasn’t entirely sure that things would proceed according to plan.

The first part of the hearing went as everyone expected. The judge, saying that the case would go ahead, noted that his ruling on diplomatic immunity would come in a matter of days. Pakistani reporters frantically began filing their stories about how this seemed a blow to the American case, and that it appeared that Davis would not be released from jail anytime soon. But then the judge ordered the courtroom cleared, and General Pasha’s secret plan unfolded.

Through a side entrance, 18 relatives of the victims walked into the room, and the judge announced that the civil court had switched to a Shariah court. Each of the family members approached Davis, some of them with tears in their eyes or sobbing outright, and announced that he or she forgave him. Pasha sent another text message to Munter: The matter was settled. Davis was a free man. In a Lahore courtroom, the laws of God had trumped the laws of man.

The drama played out entirely in Urdu, and throughout the proceeding, a baffled Davis sat silently inside the cage. He was even more stunned when I.S.I. operatives whisked him out of the courthouse through a back entrance and pushed him into a waiting car that sped to the Lahore airport.

The move had been choreographed to get Davis out of the country as quickly as possible. American officials, including Munter, were waiting for Davis at the airport, and some began to worry. Davis had, after all, already shot dead two men he believed were threatening him. If he thought he was being taken away to be killed, he might try to make an escape, even try to kill the I.S.I. operatives inside the car. When the car arrived at the airport and pulled up to the plane ready to take Davis out of Pakistan, the C.I.A. operative was in a daze. It appeared to the Americans waiting for him that Davis realized only then that he was safe.

The Davis affair led Langley to order dozens of covert officers out of Pakistan in the hope of lowering the temperature in the C.I.A. – I.S.I. relationship. Ambassador Munter issued a public statement shortly after the bizarre court proceeding, saying he was “grateful for the generosity” of the families and expressing regret for the entire incident and the “suffering it caused.”

But the secret deal only fueled the anger in Pakistan, and anti-American protests flared in major cities, including Islamabad, Karachi and Lahore. Demonstrators set tires ablaze, clashed with Pakistani riot police and brandished placards with slogans like “I Am Raymond Davis, Give Me a Break, I Am Just a C.I.A. Hit Man.”

The entire episode — and bin Laden’s killing in Abbottabad later that spring — extinguished any lingering productive relations between the United States and Pakistan. Leon Panetta’s relationship with General Pasha, the I.S.I. chief, was poisoned, and the already small number of Obama officials pushing for better relations between Washington and Islamabad dwindled even further. Munter was reporting daily back to Washington about the negative impact of the armed-drone campaign and about how the C.I.A. seemed to be conducting a war in a vacuum, oblivious to the ramifications that the drone strikes were having on American relations with Pakistan’s government.

The C.I.A. had approval from the White House to carry out missile strikes in Pakistan even when the agency’s targeters weren’t certain about exactly whom they were killing. Under the rules of so-called “signature strikes,” decisions about whether to fire missiles from drones could be made based on patterns of activity deemed suspicious. For instance, if a group of young “military-age males” were observed moving in and out of a suspected militant training camp and were thought to be carrying weapons, they could be considered legitimate targets. American officials admit it is nearly impossible to judge a person’s age from thousands of feet in the air, and in Pakistan’s tribal areas, adolescent boys are often among militant fighters. Using such broad definitions to determine who was a “combatant” and therefore a legitimate target allowed Obama administration officials at one point to claim that the escalation of drone strikes in Pakistan had not killed any civilians for a year. It was something of a trick of logic: in an area of known militant activity, all military-age males could be considered enemy fighters. Therefore, anyone who was killed in a drone strike there was categorized as a combatant.

The perils of this approach were laid bare on March 17, 2011, the day after Davis was released from prison and spirited out of the country. C.I.A. drones attacked a tribal council meeting in the village of Datta Khel, in North Waziristan, killing dozens of men. Ambassador Munter and some at the Pentagon thought the timing of the strike was disastrous, and some American officials suspected that the massive strike was the C.I.A. venting its anger about the Davis episode. More important, however, many American officials believed that the strike was botched, and that dozens of people died who shouldn’t have.

Other American officials came to the C.I.A.’s defense, saying that the tribal gathering was in fact a meeting of senior militants and therefore a legitimate target. But the drone strike unleashed a furious response in Pakistan, and street protests in Lahore, Karachi and Peshawar forced the temporary closure of American consulates in those cities.

Munter said he believed that the C.I.A. was being reckless and that his position as ambassador was becoming untenable. His relationship with the C.I.A. station chief in Islamabad, already strained because of their disagreements over the handling of the Davis case, deteriorated even further when Munter demanded that the C.I.A. give him the chance to call off specific missile strikes. During one screaming match between the two men, Munter tried to make sure the station chief knew who was in charge, only to be reminded of who really held the power in Pakistan.

“You’re not the ambassador!” Munter shouted.

“You’re right, and I don’t want to be the ambassador,” the station chief replied.

This turf battle spread to Washington, and a month after Bin Laden was killed, President Obama’s top advisers were arguing in a National Security Council meeting over who really was in charge in Pakistan. At the June 2011 meeting, Munter, who participated via secure video link, began making his case that he should have veto power over specific drone strikes.

Panetta cut Munter off, telling him that the C.I.A. had the authority to do what it wanted in Pakistan. It didn’t need to get the ambassador’s approval for anything.

“I don’t work for you,” Panetta told Munter, according to several people at the meeting.

But Secretary of State Hillary Clinton came to Munter’s defense. She turned to Panetta and told him that he was wrong to assume he could steamroll the ambassador and launch strikes against his approval.

“No, Hillary,” Panetta said, “it’s you who are flat wrong.”

There was a stunned silence, and National Security Adviser Tom Donilon tried to regain control of the meeting. In the weeks that followed, Donilon brokered a compromise of sorts: Munter would be allowed to object to specific drone strikes, but the C.I.A. could still press its case to the White House and get approval for strikes even over the ambassador’s objections. Obama’s C.I.A. had, in essence, won yet again.

As for Raymond Davis, he tried to settle back into his life in the United States after being flown out of Pakistan. He found work as a firearms instructor, but in the end he couldn’t stay out of trouble. On Oct. 1, 2011, just seven months after his abrupt departure from Pakistan, Davis was eyeing a parking spot in front of a bagel shop in Highlands Ranch, Colo., a suburb of Denver. So was Jeffrey Maes, a 50-year-old minister who was driving with his wife and two young daughters. When Maes beat Davis to the spot, Davis shouted profanities through his open window. Then he jumped out of his car and confronted Maes, telling the minister that he had been waiting for the parking spot.

According to an affidavit given by Maes, he told Davis to “relax and quit being stupid.”

Davis struck Maes in the face, knocking him to the pavement. Maes said in court that when he stood up from the fall, Davis continued to hit him. The minister’s wife, later recalling the episode, said she had never in her life seen a man so full of rage. Just last month, after protracted legal proceedings, Davis pleaded guilty to a charge of third-degree misdemeanor assault and was sentenced to two years of probation. A judge ordered him to pay restitution and attend anger-management classes.

On the streets and in the markets of Pakistan, Raymond Davis remains the boogeyman, an American killer lurking in the subconscious of a deeply insecure nation. On a steamy summer night last summer, Hafiz Muhammad Saeed — the head of Lashkar-e-Taiba and the reason Davis and his team were sent to Lahore in the first place — stood on the back of a flatbed truck and spoke to thousands of cheering supporters less than a mile from Pakistan’s Parliament building in Islamabad. A $10 million American bounty still hung over Saeed’s head, part of a broader squeeze on Lashkar-e-Taiba’s finances. But there he was, out in the open and whipping the crowd into a fury with a pledge to “rid Pakistan of American slavery.” The rally was the culmination of a march from Lahore to Islamabad that Saeed ordered to protest American involvement in the country. The night before the march reached the capital, six Pakistani troops were killed by gunmen riding motorcycles not far from where the marchers were spending the night, leading to speculation that Saeed had ordered the attack.

But Saeed insisted that night that he was not to blame for the deaths. The killers were foreigners, he told the crowd, a group of assassins with a secret agenda to destabilize Pakistan and steal its nuclear arsenal. With a dramatic flourish, he said he knew exactly who had killed the men.

“It was the Americans!” he shouted to loud approvals. “It was Blackwater!” The cheers grew even louder. He saved the biggest applause line for last: “It was another Raymond Davis!”

This article is adapted from “The Way of the Knife: The C.I.A., a Secret Army, and a War at the Ends of the Earth,” published by the Penguin Press.

Mark Mazzetti is a national-security correspondent for The Times. He shared a 2009 Pulitzer Prize for coverage of Afghanistan and Pakistan.