The US-backed fighters in Syria have declared military victory over ISIL on Saturday, ending a four-year battle against the group that once held territory spanning a third of Syria and Iraq.
After weeks of heavy fighting, the tent camp where the Islamic State of Iraq and the Levant (ISIL, or ISIS) fighters) had made their final stand in the village of Baghouz was bombed to shreds.
A field pitted with abandoned trenches and bomb craters, and littered with scorched tents and the twisted metal carcasses of vehicles, was all that remained.
Half buried in the dirt was a tattered shred of ISIL's notorious black flag, while a giant yellow flag belonging to the Syrian Democratic Forces (SDF) fluttered atop a shell-pocked building.
An official of the SDF announced the defeat of ISIL via Twitter on Saturday.
"Baghouz is free and the military victory against Daesh has been achieved," tweeted Mustafa Bali, a spokesperson for the Kurdish-led SDF, referring to ISIL by its Arabic acronym.
The elimination of the last stronghold in Baghouz brings to a close a gruelling final battle that stretched across several weeks and saw thousands of people flee the territory and surrender in desperation, and hundreds killed.
It is not known whether the group's leader, Abu Bakr al-Baghdadi, is still alive or where he might be hiding.
It spells the end of the ISIL group's so-called caliphate, which at its height four years ago was home to some 8 million people, but the group still maintains a scattered presence and sleeper cells across Syria and Iraq.
ISIL affiliates in Egypt's Sinai Peninsula, Afghanistan and other countries continue to pose a threat, and the group's ideology has inspired so-called lone-wolf attacks that had little if any connection to its leadership.
The campaign to take back the territory by the US and its partners has spanned nearly five years and unleashed more than 100,000 bombs and killed untold numbers of fighters and civilians.
Rise and fall of ISIL
ISIL began as an offshoot of al-Qaeda in Iraq, which in 2006 became known as the Islamic State of Iraq (ISI). The movement, led by key al-Qaeda figures, played a major role in driving the sectarian conflict that followed the US invasion in 2003.
ISI carried out deadly attacks in the Iraqi capital, Baghdad, during this period, targeting Western-allied tribal leaders and US army posts before eventually being pushed out.
Undeterred, it soon pitched up in Mosul, Iraq's second-largest city, which it then used as a hub to continue its attacks.
In 2010, al-Baghdadi was named the ISI chief. Two years later, he mandated ISI affiliates to set up an offshoot in Syria - a country that had been forced to contend with its own civil war.
Members of that offshoot, first known as Jabhat al-Nusra, were then integrated into ISIL after a number of defections.
ISIL quickly began to establish its presence over drained, vulnerable, war-torn areas in Syria and Iraq, making it easy for the group to gain both influence and military power.
Meanwhile, in Raqqa, ISIL worked on weakening the Free Syrian Army (FSA), which opposed forces loyal to Syrian President Bashar al-Assad. It eventually ejected the two largest FSA factions at the start of 2014.
At its height, the group carried out massacres and documented them with slickly produced videos circulated online. It beheaded foreign journalists and aid workers, and burned alive a captured Jordanian pilot.
During a rampage through Iraq's Sinjar region in 2014, it captured thousands of women and girls from the Yazidi religious minority and forced them into sexual slavery. Many remain missing to this day.
The group also used its caliphate as a launchpad for attacks around the globe, including the assaults in Paris in 2015 that killed more than 130 people.
While it imposed an unforgiving version of Islamic law through public beheadings and crucifixions, the group also carried out the mundane duties of governance in its territories, including regulating prices at markets and repairing infrastructure. (Aljazeera/Masdar)
Cornered in Baghouz, the group fought fiercely and desperately to hang on to the last shred of territory it controlled, using thousands of civilians, including women and children, as human shields.