There are two schools of thought about the nature of the threat posed by the Islamic State in Iraq and Syria (ISIS). Some experts say the group is nearly vanquished as it struggles to hold on to Mosul, Iraq, and prepares for the inevitable fight for its capital in Raqqa, Syria. Other analysts see ISIS as invincible, destined to wreak havoc in the Middle East for the next decade and beyond.

In some ways, both of these perceptions are true, which is why ISIS is such a unique adversary and terrorism such a difficult tactic to combat.

The End Is Almost Near

Over the course of the past year, ISIS has lost a significant percentage of the land it once controlled in Iraq, Syria and elsewhere, including Egypt's Sinai Peninsula, Libya, Afghanistan, and Nigeria. Its finances are being constricted and its fighters are abandoning the organization in droves. Moreover, many of its leaders, including Abu Abdul Rahman, a top lieutenant of ISIS leader Abu Bakr al-Baghdadi, and some of the group's most prominent external operations planners, are being killed and captured faster than they can be replaced.

As a brand, ISIS is also suffering. Its popularity is ebbing throughout parts of the Arab and Islamic world and, as terrorism expert John Horgan of Georgia State University and his colleagues recently pointed out, it is being forced to rely more on older recruits to carry out attacks, a turn of events that is perhaps a sign of desperation.

Indeed, ISIS's tenure as an organization that controls vast swaths of territory and claims to be a legitimate caliphate is almost certainly coming to an end. But as the group transitions from an insurgency to an underground terrorist movement, more decentralized and diffuse, it will be able to survive and persist and remain capable of launching sporadic, if not spectacular, attacks.

ISIS as Eternal

Even as ISIS loses territory and its insurgency is defeated, it will still pose a formidable challenge to international security.

Even as ISIS loses territory and its insurgency is eventually defeated in both Iraq and Syria, it will still be able to pose a formidable challenge to international security. Its media operations will continue unabated and may even increase. Reports from EUROPOL indicate that ISIS has built its own social media platform in an attempt to evade law enforcement and intelligence services.

Furthermore, it will retain the ability to successfully conduct major terrorist attacks in Europe, perhaps on the scale of the March 2016 Brussels attack, as well as the ability to commit less sophisticated terrorist attacks with regular frequency, as evidenced by the steady occurrence of lower-level plots and attacks in France and elsewhere in Europe. In the latest edition of its online magazine Rumiyah, ISIS implores its followers in Europe to tap into criminal networks to obtain weapons that can be used to conduct attacks. And, as was evident in Nice and Berlin, an ordinary truck can be a potent weapon in the right circumstances.

Another reason why the ISIS threat may be enduring is the protean nature of Salafi jihadist ideology, which has proven resilient and attractive in diverse locales. Even as ISIS has lost territory, its message has found fertile ground in parts of Africa, South and Southeast Asia, as well as in poor neighborhoods throughout Europe. The organization seeks out weak states and ungoverned spaces and inserts itself into local conflicts in an almost parasitic manner, claiming to be a protector of the ummah, or worldwide community of Muslims, even as it engages in predatory behaviors such as extorting people in that same population.

Finally, ISIS has proven to be a highly adaptive adversary. On the battlefield, its fighters have used drones to drop grenades on Iraqi troops. In cyberspace, there is reason to worry that the group may be able to take advantage of virtual currencies such as Bitcoin to move money surreptitiously and finance ongoing operations while evading the watchful eye of counter-threat finance organizations unable to trace the movement of funds on the web. As ISIS continues to lose territory, it will also lose the ability to tax and extort the population in those territories. It will need to discover opportunistic methods of accessing funds.

Current State of the Threat

ISIS is in the process of being defeated as an insurgency while preparing to transform its organization into a clandestine terrorist group. As evidenced by its operations in Mosul, ISIS is not giving up without a fight. Militants have dug in and deployed wave after wave of suicide attackers in attempts to fend off advances from the Iraqi security forces. In Raqqa, ISIS is believed to have a core group of approximately 4,000 fighters prepared to defend its position.

ISIS is being defeated as an insurgency while preparing to transform into a clandestine terrorist group.

The fight for Raqqa will be even bloodier and more drawn out than the ongoing battle for Mosul. ISIS will likely exploit images of suffering civilians for propaganda value. The politics behind the fight against ISIS in Raqqa are also complicated. Turkey is adamantly opposed to the current U.S. plan, which involves arming Syrian Kurds. Will the United States cooperate with Russia? Will defeating ISIS in Raqqa embolden an Assad regime that has already used chemical weapons against its own population? On these—and other fronts—there are more questions than answers.

Looking Ahead

As ISIS continues to erode, the threat from foreign fighters attempting to return to their countries of origin still looms large. The degradation of ISIS could embolden al Qaeda in Syria, with combatants switching sides to survive and continue fighting.

In Syria, a civil war continues to rage with no end in sight, while in neighboring Iraq, the dysfunctional domestic political situation that contributed to the rise of ISIS has become the status quo. Intensifying sectarian conflict between Sunni and Shia will elevate ISIS's appeal among Sunnis.

Further, even though ISIS's regional affiliates have lost territory over the past year, there is serious potential for reinvigorated branches to emerge over the next three to five years in Libya, Yemen, Afghanistan and Egypt, just as al Qaeda in Iraq and al Qaeda in the Arabian Peninsula grew out of the al Qaeda core in Pakistan during the mid-2000s. In other words, the more tenuous command and control of these satellite groups become, the more likely they are to develop into highly capable and lethal entities in their own right.

The threat from ISIS is global, but the response by Western and regional nations has been parochial. To be fair, marshalling an effective and comprehensive response is difficult because each nation in the anti-ISIS coalition has its own national interests and varying priorities.

In the final analysis, ISIS will continue to pose a serious threat to the countries where it operates and to the Western nations it targets. The organization will evolve, adapt, and survive until it is inevitably eclipsed in popularity by a new Salafi-Jihadist group capable of usurping leadership of the global jihad and supplanting ISIS.

Colin P. Clarke is a political scientist at the RAND Corporation and an associate fellow at the International Center for Counter Terrorism. He is the author of “Terrorism, Inc.: The Financing of Terrorism, Insurgency, and Irregular Warfare.”

This commentary originally appeared on The Cipher Brief on May 18, 2017. Commentary gives RAND researchers a platform to convey insights based on their professional expertise and often on their peer-reviewed research and analysis.