PARIS—Right in front of our eyes, the cloak of religion that the so-called Islamic State uses to lure recruits and justify its atrocities is being stripped away. More important, even, than the horrific battles it has lost in Iraq and Syria, is the destruction of the illusions that surround it, the demystification of its fighters, the revelation of the lies they were told, and that they told others.

We now have the detailed testimony of scores of defectors and prisoners who have talked in great detail about their experiences. Some of the jihadis are repentant, some not—indeed, many who are now in the French prison system remain defiant. But most bear witness, in their way, to the decay of the self-proclaimed caliphate.

This is not to say the terror threat from the group known as ISIS is over, and most problematic for the security of Europe and the United States are those who were recruited in the West and who may return from the battlefields of the Middle East and North Africa to their original homes, bringing their anger and hatred with them. Others, still more problematic, may have nourished those emotions without ever having left their homes at all. The carnage over the last two years in Paris, Brussels, Orlando, Stockholm, Nice, Berlin, London, and Manchester, to name only the most horrific incidents, is testimony to the ever-present danger.

But to understand the enemy is a major step in defeating him, and there are important ways to do that.

The first step is to take religion out of the picture. The idea of it obviously plays a vital role, but that often comes later. When building a picture of the way terrorists see themselves, the exegesis of the Quran and the sayings of the Prophet are not the most useful place to begin. Worse, an obsessive focus on the faith can blind us to some basic characteristics.

Would-be jihadis who come from the U.S., Europe or Australia, especially those convinced to bring the war home, share core traits with terrorist recruits of almost any persuasion, from white supremacists to the Irish Republican Army or the radical leftists of the 1970s like the Weather Underground and the Red Brigades.

These are:

Testosterone. They are almost always young men, even though many groups are now recruiting women and even pressing little girls into service.

Narrative. They may not have been oppressed themselves, but they identify strongly with people who are downtrodden and see their role as one of a protector—the knight in shining armor.

Theater. They want to create a spectacle of their presumed heroism that the world will remember.

All of which works out to a convenient and evocative abbreviation—Testosterone, Narrative, Theater: TNT— which may sound a bit glib but holds up well under examination.

On the first element, one can understand testosterone almost literally as “biological explosive material,” says Anne Speckhard, a professor of psychiatry and director of the International Center for the Study of Violent Extremism in Washington, D.C. She and her colleagues have interviewed hundreds of terrorists and their families over the last 20 years, including dozens from ISIS. Testosterone, she says, “is basically energy,” the drive and aggression that all armies look for in their young male recruits.

Sex is part of the terrorist spiel. The Islamic State group, like Hamas and others before it, famously tries to attract young men with the promise of wives and slave girls in this world, and the Quran’s dark-eyed virgins waiting for them in the next.

But jihadis recruited in the West may have found it fairly easy to have sex where they were, so that part of the picture shouldn’t be overstated.

Hugo Micheron, a French doctoral candidate at the prestigious École Normale Supérieure who has interviewed nearly 80 present and former jihadists, many of them in French prisons, tells of one who was a recruiter for ISIS in France. He never went to the Islamic State itself because, as the recruiter told Micheron, “I am too attached to the women here. … The girls who go there are ugly or they are f***ed up.”

Speckhard interviewed many jihadi sympathizers in Belgium who had never had any particular problems finding women who’d go to bed with them. But “testosterone” in this context is not just about having sex, she points out. It relates to the core question of how one proves one’s manhood, retains one’s dignity, reacts in the face of humiliation—which is the common experience of many people from Muslim backgrounds in Europe, especially young men without jobs and without the ability to start and sustain families.

In several well-known cases, jihadi recruits had earlier thought about joining the regular national army in their home countries, and there are a handful who thought they would make their reputations with hip-hop music. One who went by the stage name Lyricist Jinn used his old Twitter handle to post a photo of himself in Syria holding up a severed head and the caption, “Chillin’ with my homie or what’s left of him.”

But such grotesque examples can be a little misleading. When the Islamic State was at the height of its foreign recruitment in 2014 and 2015, drawing in tens of thousands of young men from around the world, it promised them classic symbols of dignity and manhood: Not only a wife, but a home, and an income. All they had to do was be ready to die for the cause.

And the rationale for that cause is the narrative, the N of TNT, which is much more easily understood than the moral complexities of religion or ideology. Invariably, for all terrorists, it is a narrative of self-sacrifice to defend the oppressed.

“Part of the terrorist meme historically has always been that they are the ones who are wronged and they have no choice,” says Bruce Hoffman, director of Georgetown University’s Center for Security Studies and author of the classic Inside Terrorism. “All terrorists are fighting ‘a defensive war.’” And along with that fight, they adopt the language and accoutrements of soldiers. “No terrorist group in history has ever called themselves the Red Terrorist Faction or the Irish Republican Terrorists.” They represent themselves with military names, or as a state, or with some anodyne code name like Al Qaeda, which means simply, “The Base.”

Through their “defensive” war, as Hoffman puts it, “someone who would be marginalized in conventional life would go from being a zero to a hero.”

For the jihadis, there is the added historical-religious overlay of Medieval chivalry. The core ideological work of Al Qaeda as written by Ayman al Zawahiri, its current leader, is called Knights Under the Prophet’s Banner, and Islamic State recruiting films are full of men on horseback, as if they were riding off to slay the “crusaders” who are the ancient, sworn enemies of Islam.

As Micheron learned in his prison interviews, there are striking parallels between the jihadi narrative and that of the violent extremists on the far right: Both preach that the West is corrupt, “dying and in decline” without faith or values beyond materialism.

Through such narratives, and then shared experience in clandestinity or combat, terror organizations can build solidarity in much the way regular armies do. As Speckhard points out, most people will not kill for themselves, but they will kill to defend their families or, in the case of the military, to defend their buddies, their “band of brothers.”

All that is exploited by the Islamic State to get fighters into combat on the battlefields of the Middle East: Theatrical videos lure them and then exalt their bravery and their martyrdom. To instill horror in their foes, they elaborately choreograph and stage rituals of death: Beheading, burning, drowning, throwing from buildings those enemies, “heretics,” and “unbelievers” who fall into their hands.

When it comes to attacks in the West, the volume gets turned up, as Europe and the United States and people around the world are forced to pay attention.

Early in this century and in the last, that sort of global resonance required press coverage. Figures like Osama bin Laden actually gave interviews to Western reporters, and casualty counts had to be high to guarantee the world noticed.

But, again, this was not an attitude unique to jihadis.

White supremacist and former U.S. Army sergeant Timothy McVeigh, convinced he was defending the racial purity of the country against the evil government in Washington, set off a huge truck bomb next to the Federal Building in Oklahoma City in 1995, killing 168 people, including 19 children, most of whom were there at a daycare center. When he was asked why he didn’t just blow up the building at night, instead of 9 o’clock in the morning, he said, “We needed a body count to make our point.” And when McVeigh was executed on June 11, 2001, he held the record for the most terrorist-inflicted casualties in American history. Three months later to the day, Al Qaeda vastly surpassed it.

In the years since then, broadband internet and social media have allowed terrorists to publicize their actions, all by themselves. But the impact goes beyond that to affect the way they organize and operate. For jihadis, says Micheron, “this has been a cultural revolution.”

At almost every level of action, from preaching to the dissemination of martyrdom videos, social media have transformed the organization of jihadi violence from a top-down structure, as it was at the height of Osama bin Laden, to a horizontal “peer-to-peer” structure, where would-be holy warriors can follow general rules but essentially act on their own: what Gilles Kepel, author of Terror in France, calls 3rd Generation Jihad.

Some of the people Micheron has interviewed credit the murderous Jordanian jihadi Abu Musab Zarqawi, who founded the core of what is now the Islamic State in 2004 and 2005, with the first real exploitation of the possibilities held out by social media. He invited followers on the Web to write and sing songs about martyrdom, with the promise that the best of them would then be disseminated in the videos that showed his men attacking Americans, or sawing off the heads of hostages. Entries came in from all over North Africa and the Middle East.

Then, in 2011 the so-called Arab Spring erupted with the help of Facebook, Twitter, and other social media mastered by a rising class of young, educated, entrepreneurial, and highly westernized men and women in the Middle East who suddenly made the jihadis seem passé and irrelevant.

The Islamic State learned quickly, exploiting resentment, unrest, and the brutal suppression of the first social media revolutionaries by the governments and the conservative Islamist movements they had hoped to replace, pushing the narrative on the Web that nobody else but the Islamic State would help fight tyrants like the Syrian President Bashar al Assad, the generals of Egypt, or the government in Baghdad. “They started to shape what we call the jihadosphere,” says Micheron.

A series of videos of ISIS defectors produced by Speckhard and her colleagues portrays an alternative narrative that also has the virtue of being true: The story of the self-declared caliphate’s crazed brutality and corruption, and the depth of disillusionment among those who have escaped it.

But is that enough?

As Kepel and Micheron point out, the narrative of the Islamic State, even in defeat, is built on a broader narrative of Salafi Islam—in fact itself a counter-narrative against the West and its supposed decadent materialism, its long history of racism, and its frequent humiliation of Muslims.

Until those issues are addressed convincingly and effectively, the combination of terrorist TNT and the "righteous" beliefs of jihadis will continue to pose a threat to peace and security. But to understand what they are looking for, and show them where the Islamic State will lead them, is the beginning of their end.

Don’t miss a rare glimpse into the world of ISIS recruitment. The two-night miniseries event, The State, continues tonight at 9/8c on National Geographic.