Despite a $25 million US bounty on his head, al-Qaeda leader Ayman al-Zawahiri apparently felt comfortable enough with the Taliban's takeover of Afghanistan to move into a home in Kabul where he would regularly appear out in the open, on his balcony.
But the US government had not given up its pursuit of one of the planners of the 11 September 2001 attacks and the heir to Osama bin Laden.
After years of tracking him down, US armed forces fired two Hellfire missiles from a drone flying above the Afghan capital, striking Zawahiri's safe house and killing him, US President Joe Biden announced yesterday.
US officials described the operation as meticulously planned as that which killed bin Laden in his Pakistan hideout in 2011.
That the leader of the violent jihadist group was in Afghanistan was not surprising: since the hardline Islamist Taliban regained control in August, al-Qaeda has felt more at home, analysts say.
But finding him was still hard.
"For several years the US government has been aware of a network that we assessed supported Zawahiri," a senior administration official told reporters.
But it was only this year that US intelligence learned that his family, his wife, his daughter and her children, had moved to the Afghan capital.
They were careful, the official said, exercising "longstanding terrorist tradecraft" to prevent anyone tracking them to the Qaeda leader.
Still, eventually Zawahiri showed up, and never left.
"We identified Zawahiri on multiple occasions for sustained periods of time on the balcony," the official said.
An attack plan developed over May and June. The United States constantly monitored the multi-story residence - just how the official would not say - to understand the family's pattern of life.
Detailed safe-house model
They studied the construction of the home, aiming to hit Zawahiri without threatening the building's structural integrity, to minimize the risk to civilians.
Defence and intelligence officials finalised the plan in June and presented it to Mr Biden in the White House on 1 July, using a detailed model of the residence, as was done before the bin Laden raid.
Mr Biden asked detailed questions on the structure, weather issues, and the risk to civilians, the official said.
Finally, on 25 July, Mr Biden - still ill with a bout of Covid-19 - made the decision.
It took place with key cabinet officials joining the final briefing, echoing the 28 April, 2011 White House meeting where president Barack Obama decided to deploy US special operations troops to enter Pakistan and get bin Laden.
At that time Mr Biden was vice president, and he expressed doubts. The risks of things going wrong were high, bin Laden had not been clearly identified, and relations with Pakistan could suffer, he later recalled.
With Zawahiri, however, no US troops would enter the country; Zawahiri was clearly identified; and relations with the Taliban were next to nil.
At the end of the discussion on the 25th, Mr Biden - as Mr Obama had done 11 years earlier - asked each participant for their view.
"All strongly recommended approval of this target," and Mr Biden gave the go-ahead, the official said.
The strike involved a US drone, armed with two precision-guided Hellfire missiles, which were launched at 6.18am Sunday, Kabul time.
Zawahiri was "killed on the balcony", the official said.
The missiles appear not to have been ordinary Hellfires, whose high explosives could have destroyed the home.
'Significant blow to al-Qaeda'
Apparent photographs of the building show only a few windows on one floor blown out, and the rest intact.
That points to the likely use of a non-explosive version of the Hellfire, the R9X, which deploys a series of knife-like blades from its fuselage and shreds its target but leaves nearby people and objects intact.
The so-called "flying ginsu" missile has been used a half-dozen or more times by US forces to kill other jihadist group leaders without hurting bystanders.
The official did not provide details, but expressed strong confidence that Zawahiri had been killed and no others were hurt.
"Zawahiri's family members were present in other parts of the safe house at the time of the strike and were purposely not targeted and were not harmed," he said.
The official said the strike "deals a significant blow to al-Qaeda and will degrade the group's ability to operate."
"As President Biden has consistently said, we will not allow Afghanistan to become a safe haven for terrorists who might bring harm to Americans," the official said.