In 1995, Kamel Daoudi, a twenty-one-year-old engineering student from the suburbs of Paris, moved out of his parents’ apartment. He had fought with his father, an Algerian immigrant obsessed with the possibility of his son’s success in France, his “acceptance by the system,” in Daoudi’s words. He resented his father and, determined to find a different path, took up the ideals of jihad.

At a small prayer hall in his parents’ neighborhood, he met a group of like-minded men, older Algerians who felt adrift in their adopted country. France seemed to them a place of libertine excess, Daoudi said, and they shared a sense of “having betrayed one’s origins a bit, one’s values, and of being obliged, in order to return to the status quo ante, to go twice as far.” Daoudi was particularly drawn to Djamel Beghal, an avuncular and charismatic man about ten years his senior, whose intellect and worldly curiosity were, like Daoudi’s, paired with an attraction to the stark aesthetic of uncompromising devotion.

Beghal was handsome, with full lips, green eyes that squinted when he smiled, and a heavy jaw that lent him the imposing air of an athlete. Like a spy, he possessed a gift for sensing the psychological contours of the people he met. He exerted a pleasant force of attraction on almost everyone he encountered, and was often liked even by those who found his ideology repugnant.

With his wife and children, Beghal left France for Afghanistan in late 2000. Daoudi followed five months later. He went “out of curiosity,” he now says, to judge with his own eyes the merits of a society governed by Islamic law. On arrival he was told that the Taliban had dynamited the Buddha statues in the cliffs at Bamiyan, soaring sixth-century monuments that had been deemed impermissible idols. This seemed to Daoudi an extravagant act. “I said to myself, ‘All right, have you chosen the right moment to come here?’ ”

He settled in Jalalabad, in the east, not far from the Pakistani border, and joined a small but influential Islamist faction led, in part, by Beghal. The group maintained friendly relations with Al Qaeda, but its aims were somewhat different, and it remained independent. “They were very critical of the Al Qaeda method, they were very critical of big attacks,” Daoudi said. “And they had a vision that was much more — less violent, let’s say, and more strategic.” Beghal’s group ran a grade school that was open to both boys and girls. It also operated a paramilitary camp where members learned to handle assault rifles and handguns, but this, according to Daoudi, was “just to be able to, if necessary, defend yourself, defend your children, your wife. It was really derisory.” For most of the four months he spent in Afghanistan, he slept at the camp.

Daoudi was charmed by the warmth of the Afghans he encountered, but he found the country to be in many ways a disappointment. The Taliban whipped beggars in the street. Almost everyone was illiterate; he once spoke with a man who maintained that the earth was flat. A few months after his arrival, the Taliban ordered Beghal’s camp closed, and Daoudi worried he might be forced to join a Taliban offensive. In August 2001, he returned to France.

When the attacks of September 11 came, Daoudi immediately recognized them for what they were; in Afghanistan, there had been talk of a major operation of some kind. Fearing arrest in the panic that followed, he fled to the United Kingdom. Five days later, he awoke with perhaps a dozen guns pointed at him. A man assigned to check him for traces of explosives was so afraid, his hands shook. “I felt bad,” Daoudi said. “I said to him, ‘Relax, sir. I’m going to be very cooperative, and I’m going to do exactly what you ask. Don’t worry.’ ”

Daoudi was charged with participating in an alleged Al Qaeda plot to bomb the American Embassy in Paris. The ringleader of the operation, according to the French authorities, was Beghal, who had been arrested in July. Daoudi denies involvement in or knowledge of any such plot; several years of investigation produced no material evidence that one existed. He and Beghal were convicted nonetheless, under a broad and controversial antiterror statute known as association de malfaiteurs terroriste, or, loosely, “terrorist criminal association.” For the majority of Daoudi’s seven years in prison, he was held in solitary confinement; during transfers to court or among prisons, he was escorted by a team of masked police commandos.

Daoudi is now forty-one. He lives in Carmaux, an unremarkable town in France’s rural southwest, with his wife and three young children. He did not choose the location. After he completed his prison term, in 2008, a French court ordered his deportation to Algeria; the European Court of Human Rights blocked the order on the grounds that, as an Islamist terror suspect, he was likely to be tortured in his native country. Eight years later, he remains under a form of house arrest, and is required to keep within the Carmaux city limits. Three times a day, he pedals a mountain bike to sign in at the local gendarmerie — he is not permitted to drive a car.

Daoudi speaks a rapid, meticulously formal French that suggests a slightly nervous mistrust. As a prisoner he was considered volatile, a tall and powerful attacker of prison guards. He served several additional months of prison time for disruptive behavior. He is pudgy now, and a bit gawky in his movements, but he carries about him a hint of anger delicately contained. He has a disconcerting air of detachment, as if he were feigning inattention in anticipation of pouncing; it is easy to detect in him what seems to be the confirmation of all one’s doubts or fears. It is also easy to like him. Daoudi laughs and smiles readily and is popular in Carmaux, where he jokes with shopkeepers and struggles breathily through an outdoor exercise class with a group of local men and women. He is renovating an old farmhouse with a red-tile roof. When asked about his life in the town, he cited Candide: “Let’s cultivate our garden.”

Beghal was released from prison in 2009. The French attempted to deport him; his expulsion was blocked; and he was placed under house arrest in Murat, an isolated township in the French interior. Shortly after his arrival, he began to receive visitors — young friends from prison and Islamists with heavy beards. Daoudi, who found Beghal “a bit irresponsible,” urged him to put an end to the visits. “This wasn’t helping matters for him,” Daoudi said.

Among Beghal’s callers were Chérif Kouachi and Amedy Coulibaly, two gruff but childlike men in their twenties. Every few weeks, they drove the 300 miles from Paris to Murat, where they hiked and joked with him for several days before returning north. In May 2010, a year after his release from prison, Beghal, his young friends, and several other men were arrested in a series of dawn raids across France. They were accused of plotting to break another Islamist from prison. In 2013, Beghal was once again found guilty of association de malfaiteurs terroriste, and he was sentenced to ten more years in prison. Coulibaly was given five years but was released in March 2014. Kouachi was never tried.

Early on January 7, 2015, in Paris, Kouachi and his brother, Saïd, stormed the offices of Charlie Hebdo, a satirical newspaper that had been designated a target by Al Qaeda for its cartoons depicting the Prophet Mohammed. They killed twelve people. On the following morning, Coulibaly murdered a policewoman and blew a hole through a man’s jaw; a day later, he killed four people at a kosher supermarket. In a video released after his death, he pledged allegiance to the caliph of the Islamic State. The first French air strikes against the Islamic State had begun four months earlier, in September 2014. In November 2015, after terrorists attacked the Stade de France, the Bataclan concert hall, and several cafés in Paris, Daoudi told me that those aerial bombing campaigns had made France “much more visible, and thus a preferred target.”

In the week following the Hebdo killings, Beghal’s prison cell was searched five times. Le Figaro affirmed that he kept up “a relationship of perpetual domination” over Kouachi and Coulibaly, “disciples” who were in his thrall. The Washington Post posited that Beghal might have arranged the apparent collaboration of Al Qaeda and the Islamic State, a joining of rivals that “would be a worrisome development in the fight against global terrorism.” Louis Caprioli, a former senior counterterrorism official for the French government, described Beghal to Reuters as a “sorcerer”: “Anyone who came into contact with him could not have helped but become more radicalized.”

Daoudi says that he detected a shift in his friend after his imprisonment. “I had a hard time going along with Beghal afterward.” Beghal seemed, at times, to have grown vengeful. “If you look back at his story, at his path, he did almost eight and a half years for the first case. He gets out, he’s placed under house arrest for about a year. And then he goes down again for a bogus affair,” Daoudi said. “That’s the ultimate terrorist factory. How do you radicalize someone? Well, there you go.”

Still, he does not believe that Beghal had any involvement in the Hebdo killings. “Honestly, I don’t think he manipulated them, or that he used them, or that he led them to do anything.” At most, Daoudi suggested, Beghal perhaps served as a “moral guarantee,” telling Coulibaly and the Kouachis that their plans were religiously permissible. In his Afghan period, Daoudi said, “Beghal wasn’t thinking that way. I knew him well enough to be able to say that.” He allowed, though, that perhaps his friend had changed. “We’re never a hundred percent sure — we don’t even know ourselves completely. How can we claim to know someone else?”

Beghal was born in 1965 in Kabylia, a mountainous Berber region in northern Algeria, to a family of means and erudition. His father had fought the French in the war of independence, but he looked on the pride and pageantry of other former fighters with scorn. He was an administrator at the state railroad and a tutor to dozens of young students from the surrounding area. Beghal’s mother, a strong-willed nurse whom he called “the panther,” cared for dying patients at the family’s villa.

Beghal was an anxious child. He often lay awake through the night, his mind racing. He had a close relationship with his paternal uncle, who directed his nephew to strengthen his Islamic faith as a way to cure his anxiety. The uncle died at the age of forty, as a consequence, according to Beghal, of the torture he had undergone several years earlier at the hands of the French. When Beghal was a teenager, the leadership of the Algerian regime cracked down on Islamists throughout the country.

“It was then that I chose my camp with a profound conviction,” he wrote in one of a series of letters that he sent me from his cell in western France. “I chose the party of Allah (God) Most High and rejected any other party or philosophy of man, where, incidentally, I could have excelled.” Beghal’s letters — 226 pages in all, written longhand on sheets of graph paper — are often boastful: the current of his words seems always to convey him back to a posture of outrage and triumphalism. He is occasionally funny, though, and at times, especially when writing about his childhood, his tone turns lyrical and nostalgic.

He arrived in France in 1987. A sister, Sakina, had already settled in the suburbs of Paris, where she cared for a young Breton girl named Sylvie Gueguen. Beghal joined his sister, Gueguen converted, and she and Beghal were married in 1990.

The couple lived in a ground-floor apartment at L’Ermitage, a boxy public-housing complex outside Paris, and had two sons. Beghal was clean-shaven, and he dressed in European clothing. He chatted with other parents as they waited outside the local nursery school. “He was a calm guy, smiling, kindly — ‘Hello, sir; hello, ma’am,’ ” a former neighbor recalled. He worked small jobs and devoted most of his time to the practice of Islam.

The mid-1990s were an inauspicious moment for this pursuit. In retaliation for France’s support of the anti-Islamist military junta in Algeria, guerrillas had begun to select French targets for hijackings, kidnappings, and killings. In July 1995, a bomb exploded on an underground commuter train in central Paris. Eight passengers were killed, and 117 people were wounded. The bombing was the first of six that year, not counting two failed attempts and several more that were averted, the authorities said, just in time.

The French rounded up hundreds of exiled Algerian Islamists and suspected opponents of the Algerian regime. These mass arrests were of questionable legality and resulted in no more than a handful of terrorism convictions, but they did much to anger Muslims in France. Beghal was arrested in 1996, in connection with an alleged support network for Algerian fighters, and held for ten hours. No charges were brought, but French intelligence began to track him.

Shortly thereafter he moved his family to Leicester, in the dreary English Midlands. (Daoudi moved into Beghal’s apartment outside Paris.) “French politics had created an atmosphere ever more oppressive and mistrustful,” Beghal wrote to me. “We could no longer make religious concessions.”

England had become a hub for international jihad, after granting asylum to exiled Islamist leaders from across North Africa and the Middle East. Among these was a Jordanian-born Palestinian cleric known as Abu Qatada, one of the world’s preeminent jihadi theologians. Beghal traveled often from Leicester to London to see Abu Qatada, who preached on Fridays to small groups of men at a rented community center on Baker Street, in central London. Abu Qatada’s exhortations to jihad were issued in a soft, deliberate, breathy voice. “He was in a dialectic of, ‘The Muslims cannot remain in this state indefinitely: their rulers are tyrannical toward them, their resources are squandered by these tyrants for the profit of Western nations, so there must be a certain awakening,’ ” said Daoudi, who followed Abu Qatada’s preaching closely from France. “And this awakening will be necessarily violent, because, well, because the tyrannical, despotic powers will want to keep their powers.”

Beghal came to feel a deep attachment to Abu Qatada, who sent Beghal throughout Europe to collect donations and distribute recordings of his sermons. The French took notice. “We saw that he was a figure who was on the rise,” said Caprioli, who was then the assistant director for counterterrorism at the DST, France’s domestic-intelligence service. The DST tapped Beghal’s phones and watched him closely whenever he was in France; in England, he was monitored by the British services.

Abu Qatada urged his followers to move to Afghanistan, which he described as the foundation of an Islamic restoration. When Beghal, his wife, and their three children arrived in Jalalabad, in 2000, they settled into the ground floor of a spacious two-story home. “To rebuild this country anew was a historic opportunity,” Beghal wrote to me. “This was my precious DREAM. Can you imagine the good fortune to have a whole virgin country ready to be drawn, shaped, adorned, instructed, constructed, repainted in the colors of an enlightened and intelligently modern Islam! Can you imagine?”

Beghal traveled often to meet with other Islamists. “In Afghanistan,” he said, “everyone is bound to meet everyone.” At least once, he spoke with Ayman al-Zawahiri, the jihadist ideologue who is now Al Qaeda’s leader. Beghal described him as “accessible” and “welcoming,” though not one to waste time with “verbal or other futilities.” He also spent time with Abu Musab al-Zarqawi, the thuggish but “shining” and “humble” commander whose group, Jamaat al-Tawhid wal-Jihad, came to be known, in a later incarnation, as the Islamic State. “His beautiful voice at dawn prayers still resounds in my auditory memory,” he wrote. The man with whom Beghal and his family shared a home, a Tunisian known as Abu Iyadh, also went on to violent renown; in recent years, he was considered the most wanted man in Tunisia. He was reportedly killed last summer in an American air strike in Libya.

Beghal said that he resisted the idea of planning international attacks. “My opinion was: instead of lusting after the conquest of our countries of origin, still unattainable, let’s rebuild the attained — Afghanistan,” he wrote. “This is logical, simple, and a bit naïve, I acknowledge.” He declined to say whether he had ever met bin Laden but hailed him as a hero of Islam: “Hate him if you will, but acknowledge his sincerity,” he wrote.

By the summer of 2001, American intelligence agencies were issuing regular warnings within the government about jihadist strikes on U.S. interests across the world. Diplomatic facilities in France were among the suspected targets; according to Caprioli, the French had intelligence that specifically suggested a plot to bomb the American Embassy in Paris. American suspicions came to rest on Beghal.

In July, Beghal left Afghanistan with the wife and children of Abu Iyadh, whose youngest son was said to be too sick to go on living in the difficult conditions in Afghanistan. Beghal maintains that he intended to accompany the boy and his mother, a Moroccan, to her home country for medical treatment. They planned to fly from Islamabad to Abu Dhabi, and, after a layover of several hours, from Abu Dhabi to Casablanca. But American and French intelligence officials learned about the stopover in the Emirates ahead of time, from an intercepted phone conversation.

At the airport on July 29, several men in white robes and dark glasses surrounded Beghal and led him to a black SUV. He says they placed him in the back seat, blindfolded him, and shot electrical charges into his knees with what appeared to be cattle prods. Later, the echo of the engine suggested that he was descending into an underground complex. Beghal was stripped and given a blue tunic; interrogations began immediately.

Beghal claims that while he was in Emirati custody, his toenails were pulled out, his fingers were bent backward “with a sort of bottle opener, until they touched the bone of my hand,” a wisdom tooth was drilled without the use of anesthetic, and he was injected with “products producing much pain, vomiting.” His weight fell from about 200 pounds to 140, he says. (Though there have been small discrepancies in his account over the years, the claims are widely seen as credible.)

“What kept coming back,” he once wrote, “without ceasing: ‘Bin Laden gave you a mission.’ Then, in the face of my negative answers, a break and — I think after September 11 and its events — they came back with a scenario: ‘You were tasked with attacking the embassy of the U.S. in Paris,’ just like that, with no introduction. They didn’t stop hammering me with this story.”

On October 1, 2001, Beghal was sedated, strung up by his wrists “like a bat” from the ceiling of a military transport plane, and flown to France. On arrival, he was brought directly to a Paris courthouse for questioning, where he waited in the hallway outside the office of Jean-Louis Bruguière, an investigative magistrate who has handled some of the country’s most famous terrorism cases. It was late in the morning, and Bruguière and his partner, Jean-Franc ois Ricard, were conferring inside; Ricard left to buy a sandwich for lunch, and as he passed Beghal, he asked whether he might like one as well. “Yes,” Beghal said, with a prankish smile. “But preferably not with ham!” In a dozen years as a counterterrorism magistrate, Ricard said, this was the only joke he ever heard from an Islamist.

Beghal had confessed to the embassy plot while he was in Abu Dhabi, but in Paris he said that he had done so only after weeks of torture. When Bruguière heard that Beghal was retracting his confession, he was livid; in a spasm of unconscious rage, he jammed his fingers into the sopping armpits of his dress shirt.

Beghal’s confession was the only useful evidence of an embassy plot that the French uncovered in three years of investigation. In 2005, he was convicted not for the embassy plot but rather, according to the language of the ruling, for belonging to a “vast network” of men who had taken up “ideas and theses advocating jihad and violence” and had received arms training in Afghanistan. “Quite obviously,” the court found, Beghal and his accomplices, including Daoudi, were “ineluctably fated to enter, at a given time, into violent action.”

Where the American government has, by circumstance and by choice, handled Islamist terror suspects primarily as enemy combatants to be kidnapped or killed, France has generally treated them as criminals to be tried. It is the power of association de malfaiteurs terroriste that has, in large part, permitted this judicial approach.

According to Bruguière, who is often credited as the architect of the law, it was designed as a “force multiplier in prevention,” allowing officials to “detect dangerous behavior ahead of time” and to “neutralize people judicially.” The approach, he boasted, was “very new, very pioneering, and without precedent in the history of the world.” Since its passage, in 1996, association de malfaiteurs terroriste has permitted thousands of arrests and hundreds of convictions. French authorities contend that it has prevented dozens and dozens of terror killings in France.

The law criminalizes “the fact of participating in a grouping formed or an agreement established with a view to the preparation” of one of a number of “acts of terrorism.” (“Terrorism” is defined, broadly, in separate articles.) Critically, the text makes no mention of any standard for demonstrating the existence of the “grouping” or “agreement”; regular contact between suspects tends to be evidence enough. There is also no requirement that suspects have ties to any known or officially recognized terror organization. Defense attorneys routinely complain that their clients have been charged with an “address book” crime: guilt is, quite literally, established by association.

Bruguière acknowledged that he had not in fact been able to prove, “judicially,” the existence of a plot in Beghal’s case. (In the press, and in a 2009 book about his counterterrorism work, he has claimed otherwise.) “But we did establish that he was linked to a whole international network of jihadists, in Belgium, in Great Britain, and that he himself participated in plans — undefined plans, for which the targets were not given — aiming to commit terrorist actions on European soil,” Bruguière said.

Prevention is the goal, and so, by design, the existence of a plot, or rather the existence of the possibility of a future plot, is enough to win convictions. According to Irène Stoller, a former counterterrorism prosecutor, a suspect “is not convicted for an attempt,” but for his apparent intent. (An attempted act of terror can carry a life sentence; association de malfaiteurs generally carries a maximum sentence of ten years.) “That’s the utility of this infraction,” Stoller said. “It really is very, very, very useful.”

Whereas standard criminal investigations proceed backward from a criminal act, collecting evidence to deduce the guilt of one among a range of possible suspects, cases of association de malfaiteurs look forward toward an imagined act. A suspect is selected and evidence is collected in order to infer his potential for guilt in any number of possible crimes.

Beghal “didn’t have a normal way of life,” said Béatrice de Beaupuis, the prosecutor who successfully upheld his 2005 conviction on appeal. “That’s what gave him away. He fit a terrorist profile that was pretty well defined,” Beaupuis said. “We knew where they lived, they always went to the same places, they went to such-and-such countries, et cetera.”

Beaupuis acknowledged the dangers of such reasoning, but she contended that the law took those dangers into account. Sometimes, she said, there was legitimate doubt about whether suspects would in fact have committed violence. In such cases, she told me, “It’s indeed better not to keep them locked up too long, because it really risks radicalizing them.”

In May 2005, two months after Beghal’s conviction, Ricard, Bruguière’s partner in the case, met with officials from the American Embassy to discuss French counterterrorism practices. Within the French justice system, Ricard said, “the benefit of the doubt” was accorded to counterterrorism magistrates, not the suspects they investigate, according to a diplomatic cable published by WikiLeaks. “As an example,” the cable reads, “Ricard said that the proof against recently convicted Djamel Beghal and his accomplices, accused of plotting to bomb the U.S. Embassy, would not normally be sufficient to convict them, but he believed his office was successful because of their reputation.”

Ricard claims never to have said this, that it is in fact “a sort of reductionist summary of a whole series of discussions” with officials from the Justice Department and the FBI. What he meant to impress on the Americans, he said, was that he and Bruguière had demonstrated simply that Beghal had formed a “group” with the intent to “commit an action” of some sort. As for what that action could have been, Ricard admitted, “One has to be honest and objective: I don’t know.”

Unlike the legal structures by which they are judged in France, Ricard told me, Sunni jihadists do not operate in accordance with Cartesian principles; their plots do not fit neatly into the qualifications of traditional French law. “They don’t reason like us at all,” he said. “A ‘Western’ terrorist, let’s say, in a revolutionary or nationalist line of reasoning, will, for instance, give himself an objective: ‘We’re going to assassinate such-and-such person.’ Classic. Or: ‘We have to assassinate soldiers, judges, whatever you like.’ And then they acquire the means. They do the scouting. They organize themselves. They prepare the matériel. And then they take action.” For Sunni jihadists, he said, “The objective itself, the target that’s supposed to be hit, may be chosen only very late.” To require a prosecutor to prove the existence of a specific plot is to misunderstand, dangerously, the nature of the threat. “If we have to wait for them to start reasoning like us, we’re going to get blown up.”

Beghal has called association de malfaiteurs terroriste the “ ‘black hole’ of French law, which swallows up all the cases that don’t hold together.” Though the law was initially credited with stopping terror attacks in France, since 2012 jihadists have killed at least 155 people in the country. The attack in November was the deadliest episode of Islamist terror in French history.

“It’s not the judicial side that’s having the most trouble with today’s reality,” Ricard told me after the Bataclan massacre, “it’s the intelligence side.” There are too many extremists for the DST to track. What’s more, a generation of association convicts are now completing their sentences and reentering society. Beaupuis said that she has been fearing this moment for the past ten years.

Terror charges confer a certain prestige within French prisons, as do ties to celebrity criminals. Beghal, who was presented by investigators as one of bin Laden’s top operatives in Europe, was an object of awe. Muslim prisoners, especially those imprisoned on terrorism charges, viewed him as a sage.

“He is a sort of star,” said Farhad Khosrokhavar, a sociologist who has conducted more than a decade of research on religious extremism in French prisons. Guards speak of Beghal as a particularly effective jihadist recruiter. “Everyone remembers him,” Khosrokhavar said. “Each time he passed through somewhere, he left a trace.”

Daoudi told me that in exchange for a promise that Beghal use his influence to help keep the peace, one prison director allowed him to hold prayer meetings in the rec yard and to perform marriage ceremonies for other inmates in visiting rooms. “If he wanted to set off a riot, he could have just snapped his fingers,” Daoudi said.

Precisely how many French prisoners consider themselves Muslims remains unclear, as the country’s public institutions are barred from collecting ethnic or religious statistics. (In accordance with the French Republic’s egalitarian ideology, inmates are all recognized simply as inmates, just as citizens are acknowledged simply as citizens, without color or creed.) But Khosrokhavar believes that as many as 60 percent of the system’s 66,000 prisoners are Muslim. According to the prison administration, 18,000 inmates, more than a quarter of the total, fasted for Ramadan in 2014. (Muslims represent less than 10 percent of France’s population.)

“There really is an ambience of religiosity,” said Mourad Dhina, the director of the human-rights group Alkarama, which is based in Geneva. Dhina, who is also the founder of an Algerian opposition movement, was imprisoned in Paris for nearly six months in 2012, having been falsely accused by the Algerian regime of a terror plot; during his detention he met and spoke at length with Beghal. Dhina said that there was constant discussion of Islamic rules and rituals, and many young men turned to Beghal for his religious knowledge. Few other options were available: only 189 Muslim chaplains are registered with the prison system, many of them retirees volunteering their time.

In the current French context, Islam is often seen as inherently political. The separation of church and state has been enshrined in French law for more than a century, but a stringent and unaccommodating interpretation of laïcité, the country’s official commitment to secularism, has become the cultural and political norm in recent years. Many Muslims view the policy, in its present form, as little more than anti-Islamic bigotry cloaked in liberal rhetoric. (Charlie Hebdo was and remains committed to a strident, anticlerical form of laïcité.)

In prison, laïcité is the reason for rules against praying or preaching in shared spaces. It has given rise in some prisons to unofficial bans on Muslim prayer rugs and refusals to serve halal food. According to Dhina, jihadists tell new inmates, “You’re here because you’re named Mohammed,” or because “the crusaders” who control the state hate Islam. Christiane Taubira, the French minister of justice, called the prisons “fertile ground for indoctrination.”

As of June 2014, ninety inmates were registered by the prison administration as being linked to Islamist terror groups. The number had risen to 140 by October of that year, and to 200 by early 2015. According to Bruno Clément-Pétremann, who ran security for the state prison administration, another 2,000 inmates are considered “radicalized.”

All French terrorism cases are tried in Paris, where they are handled by a small cadre of specialized prosecutors; given the backlog of cases, and the often lengthy investigations they entail, many terror suspects spend years in the prisons of the Paris region, where they are housed with the general population, before being sent before a court. When Coulibaly, the kosher-grocery killer, was asked in 2010 about Islamists he knew, he told investigators, “If you want me to tell you all the terrorists I know, we’re not done yet, I know all of them: the ones from the Chechen networks, the ones from the Afghan networks.” He said he had met them in prison.

For the past twenty years, it has been the unofficial policy of the French prison administration to spread Sunni extremists throughout the population of each prison, so as to dilute their influence. (Many are held for extended periods in isolation, though they often manage to communicate with other inmates nonetheless. By Beghal’s count, he has spent nearly ten years in isolation, which he is fond of calling “legal torture.”) Evidently, the unintended consequences of this approach have been significant. “We never asked ourselves the question of whether we should be regrouping them, whether we should be handling them specially,” Clément-Pétremann said.

The flow of new inmates from the war in Syria has forced a reevaluation of the old approach. The prison administration is now experimenting with quarantine sectors and “deradicalization” programs for about a hundred prisoners. The inmates will be forced to confront victims of jihadist violence, and will speak to reformed jihadists. They will also, according to Clément-Pétremann, do group therapy and “cultural activities, with the objective of the restoration of the self, the restoring of one’s self-image.”

Beghal has been held in at least ten prisons since his arrest in 2001. In 2005, as the trial for the embassy plot reached its end, he was placed in solitary confinement in a top-floor cell at Fleury-Mérogis, a hexagonal prison complex built in the 1960s that resembles, in its lifeless geometry, the housing projects in which many of its inmates were raised. It is Europe’s largest prison, with a population of about 4,000, and it is habitually overcrowded. Coulibaly, who at twenty-three had been in and out of prison three times already, was assigned to a cell directly beneath Beghal. The two men spoke, presumably through the exterior windows of their cells. Chérif Kouachi arrived at Fleury-Mérogis at around the same time.

In 2009, Beghal’s lawyer, Bérenger Tourné, came to collect him at a detention center on the edge of Paris. The former prisoner embraced a tree and then climbed onto the back of his attorney’s motorcycle. At the Gare de Lyon he boarded a train, alone and unescorted, and rode several hours into the French interior. A small room had been requisitioned for him at a hotel in Murat; the owners, feeling bad for their lonely guest, soon moved him to a furnished apartment on a street lined with plane trees.

Beghal was gregarious and well liked in Murat. He befriended the local dentist, a devout Catholic and irrepressible conspiracy theorist who joked at their first meeting, “So it’s you, the big tough guy!” Privately, however, Beghal had grown bitter and self-righteous. From his “misadventure” with the judicial system, he wrote in 2009, he had learned that “in France, it is enough to be a Muslim, practicing, who goes more or less diligently to a mosque, who takes an interest in the suffering of Muslims in the world like the Palestinians, Afghans, or Chechens . . . to appear on the DST’s ‘shopping list’ and end up being used and presented, later, according to their needs, as being a terrorist network of the most dangerous kind. It’s as simple as that!”

He lectured his family and friends about Islamic piety, often because they sought his views, but not always. He once chastised his sister Sakina, who did not share his fundamentalist views, for wishing him a happy birthday. “The birthday is a rite of the infidels,” he told her. “I’ve said it a thousand times before. But you persist in offending Allah and pleasing and resembling the enemies of Allah with neither fear nor shame, even though this is very grave.” She replied, testily: “Pardon my ignorance, but Allah will judge whether I’m an infidel, not you.”

Yet Beghal could be patient too, even tender, especially toward the turbulent young men who were drawn to him. He adopted their slang; his text messages were composed with the lexical style of a teenager. He was still a zealot, but his persona evolved with his audience. A psychological evaluator once found him to be “amiable and menacing, decent and contemptuous.”

His wife and children visited every few months. After returning from Afghanistan, they had settled again in Leicester; the children were now in school, and the decision was made that they should stay in England. Coulibaly and Kouachi visited him several times. Often they walked in the dusky hills around Murat or exercised at the municipal soccer pitch. In a phone call recorded by investigators in April 2010, Kouachi, who was in Murat at the time, excitedly told Coulibaly that he and Beghal had been doing little more than running and sleeping.

“Oh, that’s great, you all are cool down there,” Coulibaly said.

“Yeah, we’re cool down here, all that’s missing is you, but you don’t want to come!” Kouachi teased. “Right now we’re not ‘cool,’ we’re ‘coo.’ If you was here, there’d be the l in ‘cool.’ ”

Coulibaly laughed. Beghal had been doing imitations of him, Kouachi reported, and this had kept them “dying the whole day.” Beghal, in turn, told me that Kouachi “could make a deaf-mute laugh.”

The young men seemed eager to please Beghal with their personal and religious devotion, and they often came to him with questions about what was religiously permissible. Once, Coulibaly asked whether it was acceptable for him to give money to a charity run by nonbelievers. (Beghal told him no.) Chérif wrote to say he’d fallen in love, and asked whether he should take a second wife. “A man like you needs to stay light,” Beghal replied, “and not weigh himself down with two, three, or four wives, even though it’s allowed!” To have two wives, he said, would be a “double obstacle” to hegira, emigration to a Muslim land, “or other more important things,” which were left unspecified. “Naam,” Kouachi replied, “but women, it’s some crazy stuff.” Then, in a change of tone, he continued: “I’m useless at religion, I aspire to nothing if only to take care of my wife and raise my future children in religion.”

The police investigation into the plot that got Beghal rearrested began in February 2010. Over three months, the authorities listened in on dozens of conversations among Beghal, Coulibaly, and Kouachi, as well as several other Islamists. They followed the men on the highway, and photographed them in Murat. The surveillance produced no clear indication of a terror plot. Still, as Beaupuis might have put it, the men did not seem to be behaving like normal people. On the phone, they communicated in vague, coded terms and went to great lengths to avoid speaking one another’s proper names. In May, Beghal, Coulibaly, and Kouachi were arrested and charged with association de malfaiteurs terroriste, accused of plotting a prison escape for Smaïn Aït Ali Belkacem, an Islamist involved in the bombings of 1995.

After months of further investigation, evidence for the plot remained scant and circumstantial. There was an intercepted telephone conversation between Beghal and Belkacem in which they had compared the relative merits of several ahadith, instructive episodes from the life of Mohammed — investigators presumed each to signify a different escape strategy — and discussed how best to go about acquiring books — a stand-in for guns, it was believed. “If there aren’t books,” Belkacem said at another point, “you can’t learn.” Beghal announced that he had been preparing “something” for several years, “stone by stone,” but that it would require still more time “because it’s not a joke, and it’s not a game.”

During his year of semi-liberty, Beghal’s family visited him several times in Murat. He took dozens of photographs and videos, which investigators discovered on his arrest. On a yellow summer evening, he and his family hiked the parched hills around the village. Pausing to rest, they squinted into the warm, heavy light, casting long shadows. They ate breakfast in their pajamas, in a tent at a campsite at the edge of town. Beghal’s daughter, a ten-year-old in a tattersall summer dress and bandanna, romped in a stream. In the winter, bundled in a hooded parka, she made a snow angel. Later, she held icicles under her lip like fangs and bared her teeth in a comic grimace; her father did the same, and they held their heads together for a selfie in the cold.

In drawers and boxes throughout Beghal’s apartment, investigators also found ten phones and numerous SIM cards, at least one of which had been registered under a false name. Press clippings and printouts, in Arabic and French, were piled on a desk and spoke of “kamikaze operations” and a spectacular escape, involving a helicopter, from a prison in the south of France. A laptop computer and four external hard drives held scores of similar documents and jihadist texts, in addition to images of assault rifles and the twin towers of the World Trade Center in flames.

Beghal appeared to have asked Coulibaly to buy something for him — investigators believed it to be a gun — but this could not be proved, and no purchase was found to have occurred. In the hallway closet of Coulibaly’s apartment, though, police found 240 military-grade 7.62mm cartridges. “I’m trying to sell them on the street,” he claimed. Later, he told a judge: “Never in my life would I participate in a terror attack or something as serious as that. I live in France — my family, the people close to me, everyone — and it would never even occur to me to do things like that.”

Throughout the case, there were troubling discoveries for which the defendants offered improbable explanations, but little material evidence of any particular plot. It is possible that Beghal ordered Coulibaly to buy a weapon, and that this weapon was intended to help break Belkacem from prison, just as it is possible that Belkacem was then going to poison Paris’s municipal water supply, or plant a bomb somewhere, or travel to Murat to set out on the lam with Beghal. But it could not be shown that any of these were more than alarming hypotheticals.

“It is hardly important that the goal be precise,” the state prosecutor reminded the court at trial, in 2013. “What counts is that they share a common goal and the ideology that underlies it.”

The case was indeed “a bit shaky,” a lawyer involved in the prosecution admitted. “More-cautious magistrates” might not have brought Beghal to trial. Still, Beghal “is very, very dangerous,” the lawyer contended, suggesting that investigators may have rushed to make arrests because they feared some violence was imminent. “They said to themselves, ‘We can’t wait any longer, surely we’ll find some things during our raids that will bolster our case,’ ” he said. “Once they’d done it, they saw that there wasn’t much to be found.”

On the morning of Beghal’s arrest in Murat, investigators tore out the ceiling of his apartment. According to Beghal, they called their commanders in a panic when they found no weapons: “There’s nothing! There’s nothing! Squat!”

On the final day of the trial, in the late autumn of 2013, Kouachi sat silently in the audience. (Though he had been held in prison for nearly five months and placed under court supervision for another three years, he was not tried.) By this time, it appears, either he or his brother had traveled to Yemen and returned with orders to destroy Charlie Hebdo. Across the courtroom, he and Beghal exchanged smiles. Coulibaly was given five years; he would be released just a few months later. Beghal was given ten, the maximum. This, Beghal said, was the last he saw or heard from his two young friends.

“I am not the mentor of the Kouachi brothers, Chérif and Saïd, and Amedy Coulibaly,” he wrote to me. “Believe me, these boys, these genuine brothers, brought me more than the few things I might have been able to bring them. At the moment when the world had closed its doors to me and human civilization had forsaken me, high on a mountain peak, they WERE THERE. This is nobility, true fraternity, just as recommended by our Islam. . . . By Allah Almighty I miss them dreadfully.”

In an interview Beghal gave following the Charlie Hebdo attacks, he condemned the killings, but only as tactical errors. Had he not been in prison, Beghal said, Kouachi and Coulibaly “would probably have asked my advice before moving into violence.” He claimed that he would have “guided them quite differently,” convincing them, perhaps, that Charlie Hebdo was in fact a gift to Islam. He said that he would have told them that the “intolerance,” “disrespect,” and “contempt” of the newspaper’s cartoonists “and their imbecilic supporters” would “in the end play in favor of Islam, and the strengthening of its cause in the contemporary world.” In a letter to me, he said he does not support attacks against “easy” or non-combatant targets. “I prefer and favor the power of the just word,” Beghal wrote. “The aim of my cause is to save man, not to destroy him.”

In other letters, though, Beghal defended the killers. “The Kouachi brothers have full responsibility and they took it on without complaint or sniveling, at the price of their lives and up until the final drop of blood. As for the caricaturists, and their pyromaniac allies . . . they set off their own misfortune. Would it not have been worth it for them to shut their mouths and draw something else instead of playing with a grenade with the pin pulled out?”

Still, he refused to say whether he believed the attack was just. “As for my opinion, on the question of the morality or not of the killing,” he wrote, “I probably have one, which can evolve, incidentally, according to my knowledge or weaknesses of the moment. Only, I do not have an excessive ego, nor enough narcissism, to feel myself so important as to give it.” I haven’t heard from Beghal since the November attacks, so I don’t know what he made of the most recent round of civilian deaths.

Daoudi, by contrast, was willing to say straightforwardly that he thought violence was an ineffective tool. “It means you haven’t succeeded in being understood, in being sufficiently convincing,” he said. After the shootings at Charlie Hebdo, he said, many French felt impelled to adopt the publication’s hard-line laïcité: “The famous, ‘We are all Charlie.’ ” The killers conducted “a poor analysis of what French society is.”

Yet Daoudi, too, thought that the error was more tactical than moral. “Well, I mean, objectively,” he said, after a long moment of hesitation, “without being cynical, the target was good, was the right one. As far as communication goes, the target was perfectly chosen.”

“If you really want to be cynical right up to the end,” Daoudi went on, warming to his subject, “this could actually, on the contrary, be an approach that’s intelligent, insofar as it will create a clash. A genuine clash of civilizations.” Within this framework, the backlash against Muslims would in fact be the intent of the killings; this backlash would, in turn, provoke alienation and, eventually, an uprising of the Muslim masses.

This view of the attack fits well with Beghal’s “mystical vision” of a “thousand-year Islam,” Daoudi said. And though Beghal has been critical of the Islamic State, his worldview is also compatible with the group’s call to eliminate the “gray zone” — the world inhabited by Muslims living peacefully in the West: “Muslims in the crusader countries will find themselves driven to abandon their homes . . . as the crusaders increase persecution.” In November, the French government decreed a three-month state of emergency; some officials spoke of creating internment camps for the thousands of people whom the intelligence services have deemed potential dangers.

Whatever Beghal’s original reservations about the idea of striking the West, he thinks the September 11 attacks, in particular, were justified. He told me that in the summer of 2001, the American intelligence services were “FOOLED by concentrating fully on myself, and left the gates wide open for strikes on American soil. My story poisoned what should have been their lucidity. The decree of the Just, All-powerful creator of worlds had sealed this destiny! It had to be so.”

It would be far easier to muster sympathy for the man and lament his handling by the French state if he did not believe what he believes. And yet given those beliefs, what could he possibly say, or refrain from saying, to convince the world that he is not a danger? What credence can possibly be lent to his words, or to his silence? Even if he has never committed a crime, in the traditional sense of the word, how can he be trusted not to commit violence, or not to militate for it, or not to somehow provoke it?

The same dilemma applies to Daoudi. He has served his time in prison, and, unlike Beghal, he says that his thinking has changed. He would like “to be allowed to move on,” he told me. But, he concedes that he cannot be trusted, at least not in any absolute sense. “The problem,” he said, “is that you can’t trust anyone, I don’t think.” I asked him if he was ever tempted to join the fight in Syria. Daoudi reflected briefly. “No, no, I don’t think so,” he said, “My current thinking really is to refocus my energies on myself.” Were he more cynical, more strategic, or simply less thoughtful, he might have taken this opportunity to proclaim a definitive rejection of jihad. Instead it appears that he chose to be honest, to acknowledge the vagaries of conviction and belief. It stands to reason that this apparent sincerity will not be rewarded. It is possible, of course, that Daoudi remains a committed jihadist and has calculated that small admissions will help to obscure the larger truth of his dark intent. As he said about Beghal, how can we claim to know someone else?

Open societies tend to accept this sort of uncertainty as the inevitable consequence of their openness. Such societies are premised, necessarily, on a certain faith in the good intentions of their citizens. Perhaps a government will watch its citizens closely, perhaps it will attempt to sway their opinions or engage them in debate, but punishment generally comes after the fact of a crime, not before. No one can be trusted, and yet, to some degree, everyone must be.

Beghal’s release is scheduled for 2020. Presumably he will be placed once again under house arrest somewhere in France. Perhaps he will plot his revenge; he will have little else to do. Or perhaps he will not. This will be a matter of faith.