Cornered in a dead-end tunnel, with a robot creeping towards him, Abu Bakr al-Baghdadi had nowhere left to run. Dogs barked in the darkness, a US soldier called out … and then came the thundering explosion that killed the world’s most wanted man – together with three terrified children he was using as human shields.

The US military finally caught up with the Islamic State leader in a remote hamlet of northwestern Syria, but not before he detonated a suicide vest strapped to his body as special forces troops disgorged from helicopters and crouched near the frugal stone house in which he was hiding.

Forensic specialists stood by, carrying samples of Baghdadi’s DNA and the means to compare it with remains at the scene. They quickly matched what they had with what soldiers retrieved from the underground blast. Two hours into the raid, the attackers were able to confirm that they had indeed found their man. Some soldiers secured what remained of Baghdadi in sealed bags, another group ushered 10 children to the home of a bewildered neighbour, and yet more carried bits and pieces from the home they had destroyed to eight waiting attack helicopters.

Facebook Twitter Pinterest Abu Bakr al-Baghdadi. Photograph: AP

Just before 3.30am Syrian time, the fleet of choppers took off for the return journey to Erbil, a 70-minute flight over the badlands of Syria, where the organisation that Baghdadi had led for more than six years still cast its shadow. Crossing briefly into Turkey, then into northeastern Syria, where the vanquished US Kurdish partners were this month forced into retreat, and then to the Kurdish north of Iraq, from where much of the long hunt for Baghdadi had been run, the troops unloaded their booty – delivering Donald Trump a prize he sorely needed after a miserable month for the US across the Middle East.

Baghdadi was a prize that had previously eluded all his pursuers, as well as the best technology the world’s intelligence agencies could muster; the terror tsar had long understood the perils of being a fugitive in a digital age. But the hunt for him began and ended using the more old-fashioned ways of spycraft: another person carrying a secret.

Iraqi officials say that in mid-September they identified a Syrian man who had been used to smuggle the wives of two of Baghdadi’s brothers, Ahmad and Jumah, to Idlib province via Turkey. The same smuggler had earlier helped move Baghdadi’s children from Iraq. Iraqi intelligence officers say they were able to co-opt the man and a woman believed to be his wife, as well as one of Baghdadi’s nephews, into providing information about the route he used and the destination of the people travelling with him. It was a break like no other, and was soon passed to the CIA.

By mid-October, a plan to catch or kill Baghdadi was in full swing. The operation was given the name Kayla Mueller, US national security adviser Robert O’Brien revealed on Sunday, in honour of the Arizona aid worker enslaved by Baghdadi and who later died in Raqqa.

Facebook Twitter Pinterest An aerial view shows a site hit by helicopter gunfire near Barisha. Photograph: Omar Haj Kadour/AFP via Getty Images

Iraqi officials say they provided updated real-time information to Washington as Baghdadi moved about in Idlib. Paranoid, slowed down by war wounds and stricken with diabetes, the 48-year-old was nevertheless used to changing locations. He had done so regularly throughout his life on the run, shifting between eastern Syria and western Iraq before settling in a small pocket of Idlib province, according to the Iraqi National Intelligence Service.

It was a long way from home for a man who trusted few outside Iraq and no one outside his inner circle. And it was an unlikely place to end up, according to European intelligence officials who had last tracked him to the eastern Syrian town of Baghuz in January.

By early last week, US and Iraqi officials were growing more confident that Baghdadi was indeed in Idlib province, moving between homes in a hamlet named Barisha, not far from the Turkish border. At this point, the formidable reach of Washington’s technical capabilities took over, establishing who he was with and where he was staying. One man was Abu Mohammed al-Halabi, the leader of a rival Salafi jihadi group, Hurras al-Dein, and an unlikely bedfellow for the leader of Isis; only weeks before, Hurras al-Dein members had been rounding up and executing people they had suspected of being Isis sympathisers.

According to regional officials, the house al-Halabi was staying in was built early last year above a tunnel complex. It was an ideal hideout for a fugitive and it would require a formidable force to assault it.

“By Thursday afternoon, the president and I were informed there was a high probability he would be at the compound in Idlib province,” the US vice-president, Mike Pence, told CBS news programme Face the Nation on Sunday.

Facebook Twitter Pinterest Donald Trump speaks in the White House on Sunday. Photograph: Andrew Harnik/AP

In a press conference to announce Baghdadi’s death, Donald Trump said he had given the order to go ahead with the raid on Saturday in Washington. Shortly afterwards, special forces based in Erbil were given orders to leave for Idlib. It was their biggest and most dangerous operation in the war against Isis. Russia, which controls the airspace over Idlib was given notice, so too Turkey with which the US has been at odds in recent weeks. Syrian Kurds in the north-east of the country were also briefed.

The attack force arrived just after 1am and faced a barrage of gunfire from the ground. In the fierce clashes that followed, at least nine members of Isis were killed in addition to Baghdadi, many of them family members. The landlord al-Halabi was among those to die, as were two of Baghdadi’s wives, who were both believed to have detonated suicide vests. The cornered Isis leader is believed to have dropped through a hatch into a tunnel network. Trump said the attack planners knew exactly where it was and how to breach its walls.

“The only ones remaining were Baghdadi in the tunnel and he had dragged three of his young children with him,” he said. “They were led to a certain death. He reached the end of the tunnel as our dogs chased him down.

“[Baghdadi] ignited his vest, killing himself and the three children. Test results gave certain immediate and totally positive identification, it was him.”

It was an end as murderous as his six-year reign, and no less gruesome.