Under the leadership of Abu Bakr al-Baghdadi, the ultra-violent jihadist group Islamic State (IS) evolved from a gang of insurgents to the most formidable and feared militant group in the world, expanding across continents from Africa to Australasia. Now that its chief has been killed, IS will find a way to adapt.
What remains of the IS leadership will have long planned for this day.
The group will want to demonstrate its resilience and signal to its followers that it has not been knocked off balance by the loss of such a well-known figure.
A Shura committee of senior figures - all male - will have already considered a number of candidates.
Prerequisites for the role will be an unquestionable loyalty to IS, a proven ability to plan strategically and, preferably, impeccable religious credentials, some battlefield experience and perhaps also a reputation for meting out harsh punishments.
IS has always been a bizarre fusion of ultra-conservative jihadists with former members of the late Iraqi President Saddam Hussein's military and intelligence apparatus, known as Baathists.
The Baathists provided the weapons, the explosives, the intelligence and the planning - nobody knew Iraq better than them - while the jihadists brought the fanaticism and the volunteer suicide bombers.
Baghdadi's successor will likely be someone with well-established links with both sides of this equation.
Baghdadi's loss will be keenly felt by IS for some time.
When jihadists around the world pledged allegiance to IS they invariably pledged allegiance to him personally, referring to him as "Caliph Ibrahim".
While he only appeared twice in videos, he was able to cloak himself with a sheen of religious authority.
He claimed direct descent from the Prophet Muhammad's Quraishi tribe and delivered his announcement of a "caliphate" from inside Mosul's Great Mosque, which he later ordered to be blown up.
The fact that Baghdadi was a serial rapist, forcing himself on, among others, the captured American aid worker Kayla Mueller, and presiding over the mass enslavement of Yazidi women and underage girls, does not seem to have troubled his followers at all.
The most likely targets will be in Iraq and Syria, where access to weapons, explosives and suicidal volunteers is easiest to come by.
But ever since IS lost its last piece of territory at Baghuz in Syria, it has been vowing to continue its attacks in what it calls "a war of attrition".
Europe, the US, North African, Gulf Arab and Asian countries are all in the sights of IS.
Even so-called "lone wolf" attacks, carried out by solitary individuals far from the Middle East and radicalised over the internet, are likely to be claimed by IS as payback for the death of Baghdadi.
France, which has long been close to the top of the IS target list in Europe, has warned its citizens to be on their guard.
Much as IS would like to stage a spectacular, mass-casualty attack, its leadership knows that the more elaborate the plan, the greater the chance of it being discovered by security services.
So in the immediate future it is most likely to opt for low-tech, simple attacks with relatively little preparation.
Rebuild and expand
IS has a disturbing track record of resilience.
Under Baghdadi's guidance, and helped by the connections he made with other jihadists while incarcerated in the US-run detention centre at Camp Bucca, IS grew out of the largely beaten remnants of al-Qaeda in Iraq.
IS split away from al-Qaeda in 2016.
They disagreed on several points, notably the use by IS of extreme, sadistic violence - which al-Qaeda correctly argued was putting off the vast majority of Muslim opinion.
Al-Qaeda hoped to win over that opinion; IS didn't care. It was happy to recruit misfits, psychopaths and paedophiles, people attracted by its violence and its cruelty.
IS already has a geographically distributed franchise around the world and that is not going to disappear overnight with Baghdadi's demise.
If anything, his successor will now be looking to rebuild and expand the organisation. Outside its core area of Iraq and Syria, IS has concentrations of followers, each calling themselves a wilaya (province), in Afghanistan, Libya, West Africa, South Asia, the Philippines and South-East Asia.
They are primarily involved in local or regional grievances, but during the years that it held down a physical territory IS was able to attract recruits from dozens of countries, laying the groundwork for a dispersed network of extremists that exists today.
One question that will be troubling intelligence chiefs around the world is just why Baghdadi had sought refuge in Idlib, in the north-west corner of Syria where rival al-Qaeda-linked groups are dominant (al-Qaeda and IS have been fighting each other in Syria).
Was it simply because he hoped that was the last place his enemies would expect to find him? Or, was it, more worryingly, because he was hoping to reach out to his rivals and form an even more deadly alliance of convenience?
The answers may not transpire for some time but the clues may well be in the haul of intelligence that US Delta Force commandos spent two hours retrieving from the ruins of Baghdadi's final hiding place.