Returned foreign fighters pose a significant terrorism threat to their home countries, but policies that aim to block the flow of foreigners frustrate some of these would-be jihadists. That frustration poses new problems.

Foreign fighters generally gain training and combat experience that can lead to more sophisticated and deadly attacks. Security services are rightly alarmed by the 40,000 or so volunteers who traveled to fight with the Islamic State—a historic high for the global jihadist movement. In comparing plots involving foreign fighters and those without, leading terrorism scholar Thomas Hegghammer has found that the presence of a foreign jihad veteran both dramatically increases the terrorist plot’s chance of success and the attack’s lethality. Experience in a war zone also changes an individual’s mindset. Many individuals who fight in a foreign jihad initially have no intention of using violence at home, but while in a foreign country, they become indoctrinated and come to see their former home as enemy territory. Although I’ve argued that the relative threat regarding plots and lethality per volunteer from returning Syrian fighters may be lower than the historical average, the sheer numbers of returning foreign fighters will likely result in a large security problem. Because of this problem, the decline in foreign fighters joining the Islamic State in the last year indeed demonstrates a true success against the group.

Yet, while foreign fighters pose a potential long-term danger both in combat zones and in their home countries, their decision to go abroad may lead to decreased violence in the short-term. We should prepare for an increase in violence from individuals who might have traveled abroad to fight on behalf of the Islamic State but rather opted to remain in their home countries.

Let’s start with a data and coding problem that hinders evaluation of these “frustrated foreign fighters.” Many of the Islamic State’s Western recruits are thugs, involved with gangs, petty crime, and other unglamorous forms of violence before engaging in jihad. The specific percentage of former criminals that joined the Islamic State varies by country, but for many European countries it’s one third or more of recruits. When these violent young men go abroad to fight, some die or never return to their home countries. Thus, overall violence at home falls, though this does not correlate as a fall in terrorism. If frustrated foreign fighters cannot leave, then ordinary crime may increase.

Beyond engaging in crime, frustrated jihadists will likely attack at home if they cannot go abroad to fight. Data from the United States supports this trend, as U.S. law enforcement has proven far more successful than its European counterparts in stopping individuals from traveling to Iraq and Syria. According to data from START of the plots in the United States, 28 percent of returned foreign fighters participated in a plot, but a staggering 60 percent of frustrated foreign fighters became involved in a terrorist plot. For example, in 2015 Elton Simpson and Nadir Soofi attacked a “Draw the Prophet” event in Texas—Simpson tried to fight in Somalia and later in Syria, but the FBI’s arrest of some of his fellows disrupted his plans.

Not surprisingly, multiple countries are facing this problem, and the issue may grow as travel to the so-called caliphate becomes harder. As early as September 2014, when the Islamic State began its campaign against the West, a frustrated foreign fighter in Australia stabbed two police officers after the government revoked his passport to prevent him from traveling to Syria. Later that year in Canada, another frustrated fighter ran his car into two Canadian soldiers after the government seized his passport. Denmark, France, and Spain saw similar problems in 2015. In 2016, a Swedish Muslim was turned back twice in Turkey as he attempted to join the Islamic State in Syria: he ended up being arrested for constructing a bomb at home.

The Islamic State tried to bypass indoctrination in its camps by creating a propaganda machine that inspires many Muslims, especially in Europe, to conduct attacks. The Islamic State is shifting from its emphasis on hijrah, or migration to the caliphate, to attacks in the West. This change largely resulted from the difficulty in traveling to and from Syria and the shrinking power of the caliphate. As one French jihadist told the scholar Amarnath Amarasingam, “We believe that even a small attack in dar ul-kufr [the land of the infidels] is better than a big attack in Syria. As the door of hijrah closes, the door of jihad opens.”

This shift is even more dangerous as the Islamic State bridged the gap between top-down, directed attacks such as in Paris and “Lone Wolf” attacks like the Pulse nightclub in Orlando. “Lone Wolves” lack contact with Islamic State operatives to plan or execute the attack. Worth noting, some of the group’s attacks in Europe involved an Islamic State facilitator who helped recruit or direct the attackers—a capability that will help the Islamic State direct frustrated fighters.

The policy implications are clear, if unglamorous. Stopping foreign fighters often involves monitoring and disrupting a network of facilitators and operatives who facilitate individuals’ travel to Iraq and Syria and then return to operate on behalf of the group. Preventing attacks from frustrated fighters, however, requires a traditional policing and domestic intelligence function. Law enforcement can identify potential terrorists by monitoring social media and working with local communities as these individuals often display their jihadist sympathies in advance of their attacks, and their desire to travel to Syria and Iraq provides a marker for their intent. This strategy requires considerable resources. In Europe, police and security services at times knew many of those linked to recent terrorist attacks but prioritized resources toward others they deemed a more imminent threat—with more resources they would have to make fewer tough choices. The United States has a smaller problem and more resources, and thus has suffered far less.

The Middle East faces the largest danger posed by frustrated foreign fighters. The number of foreign fighters from the Middle East are exponentially larger than from other regions —more than 30,000 foreign fighters, compared with 6,000 or so from Europe. Additionally, some countries like Tunisia used the conflict in Syria as a safety valve for getting rid of disgruntled Salafis; more than 7,000 Tunisian Salafists traveled to Syria to fight with the Islamic State. Not only will this safety valve disappear as the Islamic State attracts fewer fighters, but some disgruntled foreign fighters will return, creating a lethal combination of former fighters and frustrated fighters as potential recruits. Unfortunately, Tunisia and many other developing world allies lack sufficient law enforcement capacity to handle this problem. For these allies, U.S. resources can make a difference: ranging from technical support to training programs to counterterrorism aid designed to expand police and intelligence programs in accord with the rule of law.

Ideally in the long-term, the Islamic State’s appeal will decline as its sanctuary crumbles. While its propaganda and ideas will be harder to combat, over time the group’s allure, based in part on its image as a winner and its ability to create a caliphate, will diminish. Successful counterterrorism policies both in the United States and in allied countries are vital to the continued decline of the group’s appeal. If levels of terrorism are low, the group’s stature will fall further, diminishing the danger it poses. Becoming a foreign fighter becomes less appealing, and the decreased flow means fewer fighters in the war zone to inspire and egg on their fellows back home. Eventually, few would-be jihadists would expect to be foreign fighters and thus frustration will decline and the number and lethality of attacks will go down. Getting to this long-term state, however, will take time and in the interim the frustrated fighters pose a serious danger.