Last year, during the chaotic US withdrawal from Afghanistan, President Joe Biden pledged his administration would not allow the new Taliban-led regime to make the country a safe-haven for terrorists.
The remarks were intended to indicate that, as far as Mr Biden’s White House was concerned, the decades-old war on terror was far from over.
Almost a year later, the president’s top security advisers approached him and suggested that intelligence officials may have located the leader of al-Qaeda, Ayman al-Zawahiri, in Afghanistan.
Identifying a high-value target
In background briefings, senior administration figures told reporters that they believed Zawahiri had returned to Afghanistan in the past year, following the collapse of the Western-backed government.
US spies had been carefully watching Afghanistan ever since the US withdrawal for signs that al-Qaeda leaders were slowly filtering back into the country, an adviser to Mr Biden said.
Zawahiri is said to have settled in a large compound with high, protective walls, in downtown Kabul with his wife and daughter.
The neighbourhood Zawahiri chose, a relatively well-to-do area called Choorpur, was home to foreign embassies and diplomats under the previous administration. Now, most of the Taliban’s senior officials live in its plush surroundings.
In early April, CIA officers first briefed Mr Biden’s advisers, and then the president himself, informing him that they had identified a network supporting the al-Qaeda leader and his family through multiple streams of intelligence, according to the briefings.
The spies had slowly established patterns of behaviour from the house’s residents, including the unique mannerisms of a woman that spies identified as Zawahiri’s wife.
Officials said they had recognised her use of terrorist “tradecraft”, which she used in an attempt to avoid leading anyone to her husband’s safehouse in Kabul.
They observed that after arriving at the house, Zawahiri never personally left the premises. But they did note his habit of appearing periodically on a balcony overlooking the property’s walls for short periods of time.
Plotting an historic raid
For Mr Biden, the opportunity to kill one of America’s most wanted men was fraught with risk.
Zawahiri was living in a dense residential neighbourhood, and the drone strike that accidentally killed 10 innocent people in Kabul, including an aid worker and seven children during the final days of the US presence in Afghanistan, will undoubtedly have played on his mind.
Throughout May and June, the US leader was focussed on the war in Ukraine and pushing through landmark legislation on gun control and climate change. But secretly a “very small and select” group of top intelligence officers began preparing several options to present to him.
Mr Biden had tasked intelligence officers with ensuring that civilians – including Zawahiri ‘s family and Taliban officials – weren’t accidentally killed in the attack.
On 1 July, Mr Biden gathered several top officials, including CIA Director William Burns and Director of National Intelligence Avril Haines, for a briefing.
Mr Biden was said to be “deeply engaged in the briefing and immersed in the intelligence” as he and his advisers gathered around a scale model of Zawahiri’s home that intelligence officials had constructed and brought to the White House.
“He was particularly focused on ensuring that every step had been taken to ensure the operation would minimise that risk,” a senior adviser said.
Mr Biden asked for information about the building’s structure and how a strike could affect it, before flying to Camp David for a weekend break.
Over the next few weeks, officials met at the White House situation room – a bunker-like command centre below the White House set up to allow the president to monitor crises at home and abroad.
They methodically planned the operation, trying to anticipate any questions the president could ask.
Meanwhile, a small team of lawyers came together to assess the legality of a strike, ultimately concluding that Zawahiri was a legitimate target based on “his continuing leadership role in al-Qaeda and his participation and operational support for al-Qaeda attacks”.
On 25 July, after convening his team one final time and asking his top advisers for their views, Mr Biden authorised the strike.
Taliban leaders scramble as US strikes
At 06:18 local time (01:38 GMT), two hellfire missiles fired by a drone smashed into the balcony of Zawahiri ‘s home, killing the al-Qaeda leader. Members of his family were unharmed, intelligence officials said.
In the aftermath of the raid, the windows of the house appeared to have been blown out, but astonishingly little other damage seemed to have been done.
There are suggestions a little-known version of the Hellfire missile was used, one without an explosive warhead. This version – called the AGM-114R9X – instead deploys six blades which swing out from the side of the missile as it approaches the target.
It is the kinetic energy from this multi-bladed weapon’s speed that causes the destruction, as they slice through whatever they hit and minimises collateral damage.
Thousands of miles away in Washington, the president was informed of the strike’s success.
On Sunday, the Taliban’s ministry of the interior told the local Tolo news outlet that a rocket strike had hit an empty house, causing no casualties. They refused to provide additional details at the time.
But the Biden administration said soon after, fighters from the Haqqani network, an ultra-violent wing of the Taliban, rushed Zawahiri’s family away from the site and engaged in a broader effort to cover-up his presence.
When a BBC reporter arrived at the house on Monday morning a Taliban cordon sharply brandished him away, aiming rifles at him and insisting that there was “nothing to see”.
US officials said “multiple streams of intelligence” had confirmed Zawahiri ‘s death, but emphasised that no American personnel were on the ground in Kabul. They refused to elaborate as to how they had confirmed the attack’s success.
Intelligence agencies jealously guard the identities of their spies, and James Clapper, a former director of national intelligence under President Obama, told the BBC that former US allies in Kabul may have provided some information.
It’s unclear what happened to Zawahiri’s body in the wake of the strike. Biden administration figures said the US had made no effort to retrieve Zawahiri’s remains, as they did in the wake of the raid that killed Osama Bin Laden.
Special forces retrieved Bin Laden’s body to confirm his identity, before burying it at sea to prevent his grave becoming a shrine to Islamists.
However, given the Taliban have cleaned the area, it is possible his remains have been retrieved.
As Mr Biden’s television address from a balcony of the White House beamed around the world, Taliban leaders issued a sharp condemnation of the US incursion into their territory. But their comments made no mention of Zawahiri.
There will now be speculation about how much knowledge senior Taliban leaders had about Zawahiri’s presence in Kabul and what assistance they might have been providing.
One resident told the BBC that Taliban fighters had been guarding the street and that the presence of “non-Afghan residents” was common knowledge among locals.
The suggestion seems likely to raise tricky questions for Taliban leaders.
Additional reporting from Chris Partridge on the Hellfire system