The "Islamic State of Iraq and Syria" (ISIS) is under attack across the remaining parts of its self-proclaimed caliphate, but what happens to its thousands of fighters as their group loses grip on territory?
Facing multiple offensives, the extremist group has lost the Libyan city of Sirte, Iraq's Mosul and Ramadi, and is now on the verge of being ousted from its former Syrian stronghold al-Raqa.
At its peak ISIS counted tens of thousands of fighters among its ranks, with US officials estimating as many as 40,000 foreign fighters travelled to join the group over the years.
Forces attacking ISIS have regularly reported the deaths and arrests of large numbers of extremists, but their figures are often vague and cannot be independently verified.
"We cannot give an exact number of those arrested but we can say that there are a good number of them being detained by our forces," said Mustafa Bali, spokesman for the Syrian Democratic Forces (SDF) currently battling ISIS in Syria.
Hiding among civilians?
A persistent fear for forces attacking ISIS is that its fighters will try to blend into the civilian population, either fleeing along with the displaced or staying behind in homes.
"The problem of operatives hiding among civilians who flee is certainly a major issue," said Aymenn al-Tamimi, a research fellow at the Middle East Forum.
"Operatives might stay behind and melt into the wider civilian population to function as sleeper cells or recruit others to become part of sleeper cells as well," he said.
In Syria, Bali said, some ISIS fighters "have been discovered in camps for the displaced via our databases".
Others have been turned in by civilians who recognised and reported them.
But some fighters slip through nonetheless, especially as "some civilians are afraid to report them, fearing revenge will be taken against them", said Rami Abdel Rahman, director of the Syrian Observatory for Human Rights.
Iraqi forces, like their counterparts in Syria, use a database to pick out suspected ISIS fighters from among civilians.
But a local Iraqi official said "a large number of ISIS elements are hiding among the population in Mosul, particularly in the Old City".
Their presence is evidenced by "the assassinations and bombings that continue daily", said Hisham al-Hashimi, a researcher who specialises in extremist movements.
What about foreign fighters?
The many non-Arab foreign fighters among ISIS's ranks may not be able to blend so easily into the fleeing civilian populations, with their features and language betraying them.
"There is a lot of (ISIS) foreign fighters there that do not want to give up and intend to fight very hard," the top coalition commander assisting and advising the SDF told AFP.
Foreign fighters are often those carrying out suicide attacks, added al-Hashimi, and by the end of any given battle "the number of them left behind is very small".
Their chances of returning home are slim, with intelligence services closely monitoring for returnees, and the Turkish border now tightly surveilled.
Charlie Winter, a senior research fellow at the International Centre for the Study of Radicalisation and Political Violence, said ISIS's own propaganda suggested a loosening of its once-tight rules against leaving its territory for that of the "unbelievers".
"The group has very indirectly -- but also in my opinion unambiguously -- essentially said that it is no longer impermissible to flee the ISIS territories," he said.
Refuge in remaining ISIS territory?
With its territory across Syria and Iraq rapidly shrinking, ISIS is now concentrating its resources in the Euphrates River valley that lies along the Syria-Iraq border, experts say.
"For a long time now the centre of gravity for the Islamic State has been shifting... towards places like Mayadeen and Albu Kamal," in the east of Syria's Deir Ezzor province, said Winter.
"ISIS has very systematically been bulking up its infrastructure and its population in these places," he added.
He said ISIS had likely ensured that large numbers of fighters moved to these areas well before they were surrounded in places like al-Raqa and Mosul.
That means now that the fight for places like Mayadeen and Albu Kamal could be "surprisingly ferocious", he said.