The armed group used to control one third of Iraq’s territory and a large part of Syria, but now it has lost most of it.

The Islamic State of Iraq and the Levant (ISIL, also known as ISIS) armed group has suffered a string of defeats on the battlefield that have left its “caliphate” straddling Iraq and Syria in tatters, three years after it was declared.

With Baghdad’s announcement on Thursday that Nineveh province is back under Iraqi government control following the recapture of Tal Afar, ISIL has been ejected from one of its last bastions in Iraq and is left facing an advancing Arab-Kurdish force across the Syrian border in Raqqa.

What’s left of “the caliphate”?

In its heyday in 2014, almost one third of Iraq’s territory was in the hands of ISIL fighters.

Today, they are left with no more than 10 percent, according to the US-led coalition supporting Iraqi forces, in two areas: Hawija, 300km north of Baghdad, and the three locations of Qaim, Rawa and Anna in the western desert bordering Syria.

READ MORE: The rise and fall of ISIL explained

Across the border, the US-backed Syrian Democratic Forces (SDF) penetrated the group’s de-facto capital of Raqqa in June and have expelled ISIL from 60 percent of the city which they had seized in 2014.

Between 5,000 and 10,000 ISIL fighters, including commanders, have fled to the Euphrates Valley region, according to coalition officials.

The region under ISIL control runs 160km from the eastern Syrian city of Deir Az Zor, through the province of the same name and across the border to Iraq’s Qaim.

On the Syrian side, ISIL is also facing the advance of Russia-backed Syrian regime forces towards Deir Az Zor province.

What power does ISIL retain in Iraq?

Despite its military defeats, ISIL has sleeper cells that have carried out devastating attacks, mostly targeting Shia Muslims, whom the Sunni group regards as heretics, in cities recaptured by Iraqi forces and in Baghdad.

ISIL returning to insurrection mode poses a serious challenge for security forces and is a constant threat to Iraqi civilians in a predominantly Shia country where sectarian strife is easily stoked.

ISIL power abroad

According to many security analysts, the disintegration of the ISIL “caliphate” and dispersion of its members have heightened the risk of attacks abroad.

Even without its territorial base in Iraq and Syria, ISIL has become a “franchise”, they say.

Groups pledging allegiance to ISIL and “lone-wolf” assailants have carried out deadly attacks in Europe in the name of the group.