As ISIS' territorial control erodes in Iraq and Syria, many of the more than 40,000 foreign fighters who joined the terrorist group have started to head back to the countries from which they came.

There are now at least 5,600 people from 33 countries who have left ISIS' so-called caliphate and returned home, according to a report from The Soufan Center.

Some countries have seen more returnees that others: About half of the fighters from the UK, Sweden, and Denmark have returned, while 10% of the fighters from Russia or former Soviet republics have gone back.

Iraqi security forces with an ISIS flag they pulled down at the University of Anbar, in Anbar province, July 26, 2015. REUTERS

Some countries in Southeast Asia, however, have seen the return of not only their own citizens, but also the arrival of ISIS fighters who have chosen not to go back to their own countries.

ISIS kept detailed records of the fighters who joined, and those records — plus captured computers and cellphones — have helped the US-led coalition fighting the group create a profile of its membership.

Nearly 20,000 names have already been shared with Interpol.

ISIS' success in attracting foreign recruits — many times more than the Afghan fighters resisting the Soviet Union in the 1980s drew — may help sustain the group in the long-term, if not as a cohesive group then as an inspiration for others.

"It is highly likely that even as the territorial caliphate shrinks and is increasingly denied an overt presence, its leadership will look to supporters overseas, including returnees, to keep the brand alive," the report states.