Not since al Qaeda flew planes into New York's Twin Towers has any group which claims to have Islam as its driving principles caused such alarm as Islamic State.
Its demise comes after a war of attrition which has involved the armed forces and resources of dozens of countries.
Thousands of people have been killed as part of that war or directly at the hands of Islamic State (IS), which is also called Daesh, ISIS and ISIL.
But what was IS, who was behind it and why did so many resources go into stopping it over the last five years?
The origins of Islamic State date back to the US invasion of Iraq in 2003.
In the chaos that descended on the country in the aftermath of the removal of Saddam Hussein's regime, various groups emerged which attempted to seize control of territory in the power vacuum and the fight the American invaders.
One of them was eventually led by a cleric called Abu Omar al Baghdadi, who became the first leader of a group he called Islamic State of Iraq (ISI). He was killed in a US-led operation but was quickly succeeded by Abu Bakr al Baghdadi.
Abu Bakr al Baghdadi recruited several ex-members of Saddam Hussein's officer corps.
It coincided with the start of the Syrian civil war in 2011, when dozens of groups, including many with religious motivations, emerged in rebellion during the Arab Spring against President Bashar al Assad, a leader from the minority Shia Alawite tribe.
Baghdadi began sending his fighters across the border to take advantage of the growing chaos to seek allies and establish a base there.
But his attempts to merge his group with an al Qaeda-linked Syrian opposition group backfired, with the leader of AQ disowning it.
Baghdadi responded by going on the war path, capturing Fallujah in Iraq, Raqqa in Syria and sweeping across northern and western Iraq to take hold of Mosul.
On 29 June 2014, Baghdadi said he had fulfilled the group's ambition to establish the caliphate and proclaimed ISIS would from that point on be called Islamic State.
The background to the conflict was not just shaped by Iraqi anger at the US invasion. Many of the early members were driven by their hatred of Iraq's Shia Islam majority.
The radical Sunnis were extending a 1,400-year-old conflict over what they believed was orthodox Islam, which had started because of a disagreement over who would succeed the prophet Mohammed.
While the split between Sunni and Shia is not significant in many Islamic nations, it was fed in Iraq by tensions between the allegiances of different clans and political groups.
While around 42% of Iraq is Sunni, according to Pew Research, the majority live in a triangle to the north and west of Baghdad, but south of areas where Kurds are the biggest group, analysis by the CIA has shown.
In Syria, in contrast about 72% of the population are Sunni.
A world threat
Within days of proclaiming himself Caliph, Baghdadi said Muslims across the world should unite behind him to capture Rome in order to "own the world".
It continued to enlarge its territory, capturing gas and oil fields and oil refineries, allowing it to control the trade in a vital asset, with the potential to earn tens of millions of dollars and upset world markets.
As the world watched with dismay, the group then pushed on into areas where the little-known Yazidi and Christian minorities had lived in peace for generations, capturing hundreds of women and taking them as slaves.
US president Barack Obama authorised airstrikes against IS in Iraq and Britain and France began drops of aid to civilians caught up in the ongoing fighting.
Horrific stories began to emerge from areas IS had taken over with reports of hundreds of male civilians being executed.
IS also pressed on in Syria, capturing swathes of territory west from its now capital city of Raqqa, even threatening Lebanon and Turkey.
In the August of 2014, in response to the airstrikes, IS released a video of captured US journalist James Foley being beheaded.
The video opened with a stark image of the orange jumpsuit-wearing American saying he wished he "had more time".
A man dressed head to toe in black with a British accent stood over him, telling Mr Obama the life of another captive depended on his next move, sending shockwaves around the world.
Days later, another video was released showing the death of another journalist Steven Sotloff, again featuring the same British-accented figure, who had been nicknamed Jihadi John, and was later identified as Mohammed Emwazi.
Mr Obama stepped up his attempts to halt the impact of IS by announcing a coalition of nations would begin to "roll back" the group, mostly using airstrikes.
Despite this, IS went on to release gruesome videos indicating the beheading of three more Britons and Americans and dozens of other prisoners.
As IS's relentless march across the Middle East went on, it was becoming abundantly clear that its fighting force was being fed from much further afield than just Syria and Iraq.
Research from the International Centre for the Study of Radicalisation (ICSR) in October 2014 and the Soufan Center suggested thousands of people from nations across Europe, Africa and Asia had travelled to territory controlled by IS to swell its numbers.
The ICSR says nearly 41,500 people travelled to Iraq and Syria from 80 countries, including the UK, a quarter of whom were women and children.
Among those who travelled from the UK were three British schoolgirls who left their homes in east London and travelled to Syria in February 2015.
At its peak, in late 2014, the group is estimated to have controlled 100,000 sq km, populated by 11 million people.
Thousands of those who travelled to join IS gradually returned to their home countries, including some 425 out of a total 850 going back to the UK according to the ICSR.
Many of IS's recruits were inspired by the successes it appeared to be having on the battlefield, but also by videos it released on social media.
Among the videos it released was footage of it detonating thousands of pounds of explosives and using bulldozers to destroy ancient monuments like those at Nimrud in Iraq and Palmyra in Syria.
Militants were also accused of destroying relics in museums in Mosul and other towns, killing museum curators and selling looted objects on the black market to earn cash.
Gradually, as coalition bombs began to rain down on the IS militants on the ground, IS began to be pushed back in Iraq.
On the ground, the Kurdish forces of the Peshmerga in Iraq and the SDF in Syria received US support as they fought Islamic State fighters hand to hand.
Several British and other Western people went to join the Peshmerga in their battle to force back IS, with many losing their lives.
In 2015, Russia joined the Syrian civil war and began to help the Syrian army on its fronts with the militant group.
Turkey, which had been used widely as an entry point for foreign fighters, also began clamping down on its porous border which had been used to smuggle weapons in and oil out, according to the Financial Times.
And the Iraqi army, which had turned and fled during the battle for Mosul, regrouped and began to fight IS again, helped partly by Shia militia which was itself aided by Iran.
IS's advance and the subsequent battles to defeat it forced millions of people from their homes.
The US estimated the majority of Mosul's 1.5 million strong population had to leave the city.
Many of those who ended up joining the migrant crisis in Europe or the four million in refugee camps in Turkey came from IS-held lands.
The war on IS also left many of the towns and cities they had occupied completely wrecked.
It was feared that many of the fighters who returned from Iraq or Syria could use their military experience to wage terror attacks on their home countries, including the UK.
Dozens of people were arrested as they arrived at airports but the biggest risk came from people radicalised by the propaganda put out by IS supporters who had bought in to its ideology.
Terror attacks in Britain, France and several other countries were said to have been inspired by the group's leaders.
The US says 79 countries were involved in the fight to remove it from the map.
Defeats on the battlefield in 2016 and 2017 gradually reduced the amount of territory IS held until in July 2017 Iraq's prime minister announced the group had been removed from Mosul.
Three months later it lost Raqqa.
Donald Trump declared IS beaten in December last year but it clung on in a tiny pocket of eastern Syria until, finally, its hardcore fighters were defeated there as well.
The final denouement took a surprisingly long time to arrive - with Kurdish forces camping out on the edge of the tiny enclave of Baghouz for weeks before the victory being announced on Tuesday - testament to the sheer number of converts to its cause who continued to back it until the bitter end.
Thousands of those converts now sit in camps, facing an uncertain future.
PUKmedia / SkyNews / By Philip Whiteside, international news reporter