WASHINGTON — Intelligence officers made a crucial discovery this spring after tracking Ayman al-Zawahri, the leader of Al Qaeda, to Kabul, Afghanistan: He liked to read alone on the balcony of his safe house early in the morning.
Analysts search for that kind of pattern-of-life intelligence, any habit the C.I.A. can exploit. In al-Zawahri’s case, his long balcony visits gave the agency an opportunity for a clear missile shot that could avoid collateral damage.
The hunt for al-Zawahri, one of the world’s most wanted terrorists, stretches back to before the Sept. 11 attacks. The C.I.A. continued to search for him as he rose to the top of Al Qaeda after the death of Osama bin Laden and after the Taliban takeover of Afghanistan last year. And a misstep during the chase, the recruitment of a double agent, led to one of the bloodiest days in the agency’s history.
Soon after the United States left Kabul, the C.I.A. sharpened its efforts to find al-Zawahri, convinced he would try to return to Afghanistan. Senior officials had told the White House they would be able to maintain and build informant networks inside the country from afar, and that the United States would not be blind to terrorism threats there. For the agency, finding al-Zawahri would be a key test of that assertion.
This article is based on interviews with current and former American and other officials, independent analysts who have studied the decades-long hunt and others briefed on the events leading up to the weekend strike. Most spoke on the condition of anonymity because of the sensitive intelligence used to find al-Zawahri.
For years al-Zawahri was thought to be hiding in the border area of Pakistan, where many Qaeda and Taliban leaders took refuge after the U.S. invasion of Afghanistan in late 2001. He was wanted in connection with the 1998 embassy bombings in Tanzania and Kenya, and the C.I.A. had tracked a network of people who intelligence officials thought supported him.
The examination of that network intensified with the U.S. exit from Afghanistan last year and a belief among some intelligence officials that senior leaders of Al Qaeda would be tempted to return.
The hunch proved right. The agency found out that al-Zawahri’s family had returned to a safe house in Kabul. Though the family tried to ensure they were not being watched and to keep al-Zawahri’s location secret, intelligence agencies soon learned he too had returned to Afghanistan.
“There was a renewed effort to figure out where he was,” said Mick Mulroy, a former C.I.A. officer. “The one good thing that might have come out of withdrawing from Afghanistan is that certain high-level terrorist figures would then think it is safe for them to be there.”
The safe house was owned by an aide to senior officials in the Haqqani network, a battle-hardened and violent wing of the Taliban government, and it was in an area controlled by the group. Senior Taliban leaders occasionally met at the house, but American officials do not know how many knew that the Haqqanis were hiding al-Zawahri.
If some senior Taliban officials did not know that the Haqqanis had allowed al-Zawahri to return, his killing could drive a wedge between the groups, independent analysts and others briefed on the events said.
It is not clear why Al-Zawahri moved back to Afghanistan. He had long made recruiting and promotional videos, and it may have been easier to produce them in Kabul. He also may have had better access to medical treatment.
No matter what the reason, his ties to leaders of the Haqqani network led U.S. intelligence officials to the safe house.
“The Haqqanis have a very long relationship with Al Qaeda going back to the mujahedeen days,” said Dan Hoffman, a former C.I.A. officer. “They provide Al Qaeda with a lot of tactical support that they need.”
Once the safe house was located, the C.I.A. followed the playbook it wrote during the hunt for Bin Laden. The agency built a model of the site and sought to learn everything about it.
Analysts eventually identified a figure who lingered on the balcony reading, but never left the house, as al-Zawahri.
U.S. officials quickly decided to target him, but the location of the house posed problems. It was in the Sherpur neighborhood of Kabul, an urban area of closely spaced houses. A missile armed with a large explosive could damage nearby homes. And any sort of incursion by Special Operation forces would be prohibitively dangerous, limiting the options for the U.S. government to conduct a strike.
The search for al-Zawahri carried huge importance for the agency. After the U.S. invasion of Afghanistan, the C.I.A. base in Khost Province became home to a targeting group dedicated to tracking both Bin Laden and al-Zawahri. It was one of the leads developed by the C.I.A. to track al-Zawahri that proved disastrous for the agency’s officers at that base, Camp Chapman.
C.I.A. officers recruited Humam Khalil Abu Mulal al-Balawi, a Jordanian doctor and propagandist for Al Qaeda, who they hoped would lead them to al-Zawahri. He provided American officials with information about al-Zawahri’s health, convincing them his intelligence was real. But he was in fact a double agent, and on Dec. 30, 2009, he showed up at Camp Chapman with a suicide vest. When it exploded, seven agents were killed.
For many, the Khost attack intensified efforts to find al-Zawahri. “To honor their legacy, you carry on with the mission,” Mr. Hoffman said.
In 2012 and 2013, the C.I.A. focused the hunt on Pakistan’s North Waziristan region. C.I.A. analysts were confident they had found the small village where al-Zawahri was hiding. But intelligence agencies could not find his house in the town of about a dozen compounds, making a raid or drone strike impossible.
Still, the U.S. hunt forced al-Zawahri to remain in the tribal areas of Pakistan, possibly limiting the effectiveness of his leadership within Al Qaeda.
“Anytime anything related to Bin Laden or Zawahri hit the intel channels, everyone stopped to pitch in and help,” said Lisa Maddox, a former C.I.A. analyst. “It was the C.I.A.’s promise to the public: to bring them to justice.”
On April 1, top intelligence officials briefed national security officials at the White House about the safe house and how they had tracked al-Zawahri. After the meeting, the C.I.A. and other intelligence agencies worked to learn more about what they called al-Zawahri’s pattern of life.
One key insight was that he was never seen leaving the house and only seemed to get fresh air by standing on a balcony on an upper floor. He remained on the balcony for extended periods, which gave the C.I.A. a good chance to target him.
Al-Zawahri continued to work at the safe house, producing videos to be distributed to the Qaeda network.
A senior administration official, who spoke on the condition of anonymity to discuss the sensitive decisions leading to the strike, said the intelligence presented to the White House had been repeatedly vetted, including by a team of independent analysts tasked with identifying everyone who was staying at the safe house.
As options for a strike were developed, intelligence officials examined what kind of missile could be fired at al-Zawahri without causing major damage to the safe house or the neighborhood around it. They ultimately decided on a form of Hellfire missile designed to kill a single person.
William J. Burns, the C.I.A. director, and other intelligence officials briefed President Biden on July 1, this time with the model of the safe house, the senior official said.
At that meeting, Mr. Biden asked about the possibility of collateral damage, prodding Mr. Burns to take him through the steps of how officers had found al-Zawahri and confirmed his information, and their plans to kill him.
Mr. Biden ordered a series of analyses to try to predict the impact of the strike on the Taliban, the region and American efforts to move Afghans to the United States, the senior official said. The president also asked about the possible risks to Mark R. Frerichs, an American hostage held by the Haqqanis.
In June and July, officials met several times in the Situation Room to discuss the intelligence and examine the potential ramifications.
The C.I.A. plans called for it to use its own drones. Because it was using its own assets, few Pentagon officials were brought into the planning for the strike, and many senior military officials learned about it only shortly before the White House announcement, an official said.
On July 25, Mr. Biden, satisfied with the plan, authorized the C.I.A. to conduct the airstrike when the opportunity presented itself. Sunday morning in Kabul, it did. A drone flown by the C.I.A. found al-Zawahri on his balcony. The agency operatives fired the missile, ending a more than two-decade-long hunt.
Thomas Gibbons-Neff, Adam Goldman and Michael Crowley contributed reporting.