WASHINGTON- If the United States and its allies want to defeat ISIS and prevent its expansion, they must understand the root appeal of ISIS and of extremism generally national security experts said Monday.

At an event hosted Monday by the Atlantic Council, a foreign policy think tank, experts discussed what attracts people to extremism as well as the changing nature of ISIS as it is losing territory in Iraq and Syria.

“When it had territory in Iraq and Syria, the message to groups all over the world and to Muslims all over the world was, ‘This is the perfect place to live,’” said Jasmine El-Gamal, Atlantic Council senior fellow and former Defense Department policy adviser.

That message has grown more and more violent, she said, and they are now “telling people to stay where they are and to just wreak havoc in their own societies.”

She mentioned the growing number of lone wolf attacks in Europe, notably the recent attacks\ in Barcelona that left 15 people dead. The attack again highlighted the difficulties of identifying those who have been radicalized.

“How do you prevent someone from being radicalized online? How do you identify someone who’s being radicalized online?” El-Gamal said. “If they don’t have a criminal record and they aren’t on the radar of the authorities, how do you know when to step in and whether you can step in legally?”

Proactive measures need to be taken, she said, as the root causes of extremism, in any form, are often the same, including government disenfranchisement, economic hardship, persecution and loss of identity. These same factors exist in South Asian countries like India, where Muslims are increasingly feeling persecuted under the Hindu nationalist government of Narendra Modi. Similar tensions exist in Bangladesh, which has the fourth largest Muslim population of any country in the world, according to El-Gamal.

But Christine Fair, associate professor at Georgetown University’s School of Foreign Service, disagreed with the grievance narrative and pointed to Pakistan.

“The grievance arguments are, time and time again, not supported by the data,” she said. “The folks who support terrorism in Pakistan are, in fact, middle class. They’re urbane. They’re well educated. The people who dislike [terrorists] the most are, in fact, poor people living in cities.”

According to Fair, the reason poorer Pakistani citizens don’t support terror is quite simple: They’re the ones getting killed by it. For this reason, she is skeptical of the economic grievances argument.

“This [argument] fuels this mythology, that we have really indulged in since 2002, that we can buy our way out of this, that USAID can go in there and become part of a counterinsurgency tool,” Fair said. “If we do not understand the political sources of appeal for these organizations, rather than trying to make it a grievance based argument, we really have no chance of winning.”