With Mosul recaptured from Islamic State and Raqqa probably just weeks from being taken, the militant group is likely soon to be wiped off war-zone maps. Like Lord Voldemort in the early Harry Potter books, it won't have a physical presence — but it will live on in other forms: the minds of the foreign fighters returning to their homelands, the online presence it has built and the souls of the disaffected Sunni populations in the areas that the terrorist group has held for years.

It's important to assess all three dangers and start dealing with them even before the looming military defeat of IS.

The foreign fighters, reportedly, have been abandoning the failed caliphate in droves — the ones, that is, who haven't been killed, a number that's hard to estimate. But thousands of them are still in Syria and Iraq, and many will try to go home.