The week before last, Iraqi Prime Minister Haider al-Abadi declared that the Islamic State (ISIS) had been driven out of Mosul, the city where the group first announced its self-styled caliphate three years ago. Before long, ISIS is expected also to lose Raqqa, its last stronghold, on which its grip is already slipping. But it would be a mistake to assume that these defeats will spell the demise of ISIS or similar violent extremist groups.
A group like ISIS relies on its ability to attract young people to join its ranks, by offering frustrated individuals an ideologically charged sense of purpose. And ISIS has proven adept at doing just that, drawing fighters from all over the world who are willing to die for its cause - to create a single caliphate spanning the Arab world - and inspiring many more to carry out attacks in their home countries.
Recapturing territory from ISIS - particularly the cities that have served as "capitals" of their self-proclaimed caliphate - goes a long way toward weakening it, by sending the message that the group cannot, in fact, translate its religious ideology into a real geopolitical force. And, indeed, US intelligence estimates indicate that, by last September, the flow of foreign recruits crossing from Turkey into Syria to join groups like ISIS had dropped from a high of 2,000 per month to as few as 50.
But the experience of other terrorist groups - most notably, al-Qaeda - shows that, even without anything resembling a state, radical ideologies can survive. Their sponsors must change their tactics, building their ranks and plotting attacks underground. But they can still wreak havoc, destabilising countries and carrying out deadly assaults on civilians near and far.
Moreover, there are plenty of other like-minded jihadist groups operating in the same areas. Consider the al-Nusra Front, a former branch of al-Qaeda and one of the most powerful jihadist groups in Syria. Like ISIS, al-Nusra nurtures state-building aspirations. That effort is supported, on the religious side, by leaders who are largely non-Syrian Arabs - for example, Abdullah al-Muhaysini is from Saudi Arabia - whose religious edicts are not questioned by the largely Syrian fighters.
Al-Nusra also benefits from its links with other groups that share its desire to rid Syria of President Bashar al-Assad's regime. Indeed, al-Nusra currently dominates a coalition called Hay'at Tahrir al-Sham (HTS), which comprises 64 factions, some more moderate than others. Against this background, the notion that reclaiming territory from ISIS will amount to freeing the region of extremist groups is clearly naive.
Preventing such groups from acquiring the power they seek will require not just military defeats, but also a concerted effort to bring order to the political arena, strengthen the rule of law, and ensure broad representation. In both Syria and Iraq, this may require a closer look at the Muslim Brotherhood, an international political movement that many believe has infiltrated various Sunni radical groups, despite its public insistence that it is a non-violent movement.
More crucial for Iraq, the central government in Baghdad, led by Abadi, must overcome the sectarianism that has divided the country for decades, and that intensified in the aftermath of the United States-led invasion to oust Saddam Hussein. In fact, sectarianism is an even bigger issue in Iraq than it is in Syria, a Sunni-majority country where the ruling Assad family belongs to the minority Alawite sect of Shia Islam.
Rooting out extremism in Iraq and Syria will also require a more nuanced reckoning with the role of external powers, particularly the Gulf States. It is easy to assume that the recent split between Qatar, on the one hand, and Bahrain, Egypt, Saudi Arabia, and the United Arab Emirates, on the other, over Qatar's support for jihadist groups reflects these countries' allocation of loyalties.
But, in Iraq, both Qatar and Saudi Arabia opposed Saddam's regime and publicly support Abadi's government. At the same time, governments and private citizens from several Gulf countries - including Kuwait, Qatar, Saudi Arabia, and the UAE - have close ties with al-Nusra. Qatar's foreign minister, Mohammed bin Abdulrahman Al-Thani, has denied that his country funds the group, but also publicly called on its leaders to distance themselves from al-Qaeda, reinforcing the view that Qatar retains influence over the group.
As complex and fluid as the situation is, the key to resolving it may be rather straightforward. First, national and regional governments and non-governmental players need to find ways to cut jihadist groups' financial lifelines. Second, the hateful and violent ideology fuelling these jihadist movements needs to be confronted head-on, regardless of who might be offended.
As ISIS's dreams of a caliphate slip away, its hold over the hearts and minds of frustrated young potential fighters may be weakening. But, unless a concerted and comprehensive effort is made to discredit jihadists and strengthen political systems, the cycle of violence in Iraq, Syria, and elsewhere in the Middle East will remain unbroken.
The writer, a former professor at Princeton University and the founder and former director of the Institute of Modern Media at Al-Quds University in Ramallah, is a leading activist for media freedom in the Middle East.
Project Syndicate, 2017.