ISIS foreign fighters appear in an online video. (Screenshot: ISIS propaganda video)

(CNSNews.com) – Former Defense Secretary Robert Gates said Tuesday that the downfall of ISIS’ “caliphate” in the Middle East would not necessarily mean the defeat of committed individuals who, pretending to be refugees, may travel to Western countries and then carry out terror attacks.

Monday’s deadly terrorist bombing in Manchester, England, he said, “may be a harbinger of more such activities in the West.”

ISIS claimed responsibility for the suicide bombing that killed at least 22 people, some of them children, and injured dozens more at the end of a show featuring U.S. singer Ariana Grande at Manchester Arena.

The suicide bomber in Manchester has been identified as Manchester-born 22-year-old Salman Abedi, the son of Libyan immigrants. According to Britain's Daily Telegraph, “It has emerged that Abedi had travelled to Libya, raising fears he had been trained there and posing questions for the security services on whether he should have been tracked.”

Speaking at an event hosted by the Foundation for Defense of Democracies in Washington, Gates said whether ISIS was directly involved in planning the attack or whether it encouraged a “self-radicalized” person or group to carry it out was “immaterial, as long as they were the spark.”

Gates said the Manchester attack was a reminder that as coalition forces close in on ISIS strongholds of Raqqa in Syria and Mosul in Iraq, even though depriving them of the “caliphate and all that represented” was a huge victory, “it would be a mistake to think that this represents the defeat of ISIS itself.”

In the same way as al-Qaeda metastasized after the death of Osama bin Laden in 2011, he said, ISIS after the loss of its “caliphate” and stronghold cities in the Middle East may become more active and more aggressive in the West.

As ISIS fighters flee Iraq and Syria, “it doesn’t mean that they’re defeated individually or they’ve lost their commitment to attacking the ‘crusaders’ or whatever they want to call them.”

“It just means they’ll change their tactics.”

Gates said that “a substantial number” of ISIS fighters may already have dispersed.

“When you have the magnitude of the refugee flows that you have coming out of Mosul, coming out of Syria and so on, I think the ability to identify ISIS terrorists in the midst of those refugees is going to be incredibly difficult,” he said.

Asked by the moderator, Fox News’s Jenna Lee, what should be done to try to identify terrorists among the refugee flow, Gates said there needs to be a vetting process – but suggested that doing so was difficult in a situation where refugees were not necessarily using regular border crossings or traveling conventionally.

“Until you can get them to a given place where they can be vetted, it’s going to be very difficult to separate members of ISIS who are fleeing from regular refugees,” he said. “And my guess is that a substantial number of them have already fled.”

After the ISIS terror attacks in Paris in November 2015 in which 130 people were killed, French authorities confirmed that two of the terrorists involved had been carrying fake Syrian passports.

“Some terrorists are trying to get into our countries and commit criminal acts by mixing in with the flow of migrants and refugees,” then-Interior Minister Bernard Cazeneuve warned fellow European Union countries six weeks after the attack.