Snitching was reviled in Bulger’s Irish-American neighborhood. He thought of himself as a strategist or a liaison, not an informant. Illustration by Oliver Munday

Joseph (the Animal) Barboza was a murderer for hire from New Bedford, Massachusetts, who came by his nickname after an altercation with a minor mafioso which he elected to settle with his teeth. Barboza ultimately confessed to seven murders, and bragged to associates that he had committed many more, but he had the good fortune to be employed by the Mafia at a moment when authorities were trying desperately to better understand organized crime. In 1961, J. Edgar Hoover stressed, in a memo, the imperative to develop “live sources within the upper echelon of the organized hoodlum element.”

Barboza became a prized informant: he served as a government witness, helping to convict members of the Patriarca crime family. In fact, he was so valuable that when authorities began looking into a 1965 murder that Barboza had participated in, his contacts at the F.B.I. engineered a scheme to protect him. Barboza was never prosecuted for this crime; instead, he took the stand as the government’s star witness and implicated four innocent men in the murder. His F.B.I. handler, an agent named H. Paul Rico, boasted afterward about the ease with which the bureau had set up four “pigeons” for a crime they did not commit. All four men ended up with life sentences. (They were cleared of the murder in 2001, by which point two of them had died in prison.)

In 1969, the government placed Barboza in witness protection, relocating him to California. But in his new identity he killed a man, and when local prosecutors sought to try him for the murder, the F.B.I. concocted a second coverup, maintaining that the killing was an effort by the Mob to frame the Animal and dispatching federal agents to appear in court as witnesses for the defense. After prosecutors agreed to reduce the charge, Barboza served only four years. Upon his release, in 1975, he was promptly murdered. But the Boston F.B.I. continued to enjoy a relationship with one of his associates, Stephen Flemmi, a member of the Winter Hill Gang. Flemmi had recently become affiliated with another up-and-coming gangster, a cunning and disciplined South Boston hood named James Bulger, who was known, owing to his platinum hair, as Whitey. Bulger was an armed robber who had done a stretch in Alcatraz in the nineteen-fifties, which counted, in the underworld, as a badge of achievement. Kevin Cullen, the co-author, with Shelley Murphy, of the excellent 2013 biography “Whitey Bulger,” once pointed out that whereas in normal life we might be impressed to learn that somebody had gone to Harvard, “if you’re a wiseguy, you say, ‘Ooh, you went to Alcatraz.’ ”

Bulger exercised every day, lived with his elderly mother, and cultivated a mystique of righteous criminality. In 1975, he began coöperating with the government, joining Flemmi as what was known, in the taxonomy of the F.B.I., as a Top Echelon Informant. This defection amounted to a breach of street protocol, which was generally punishable by death. But Bulger had few worries about exposure. Even if the truth came out, he once explained to an F.B.I. official, his reputation as a ruthless but standup guy was such that nobody would believe it. “It would be too incredible,” he said.

In 2000, the Boston Globe journalists Dick Lehr and Gerard O’Neill published a book about Bulger’s years as an informant, “Black Mass: The Irish Mob, the F.B.I., and a Devil’s Deal.” Bulger was not wrong: it was incredible. A film adaptation, directed by Scott Cooper and also called “Black Mass,” has just been released; it dramatizes the story as a lethal minuet between the wily criminal Bulger (played by Johnny Depp) and the flashy, jocular F.B.I. agent named John Connolly (Joel Edgerton), who handles him. The film conveys the degree to which the relationship between informant and handler is indeed a relationship: bureaucrats can formalize the transaction in a mountain of paperwork, but in the end it hinges on two people binding their destinies together, navigating treacherous territory hand in hand.

Depp’s fine-boned beauty might seem ill-suited to the role, but he captures, with chilling precision, Bulger’s preening tough-guy narcissism. With his mortuary pallor, ice-water eyes, and swept-back yellow-white coiffure, Depp looks as if he’d climbed into the makeup chair each morning and allowed himself to be struck by lightning. He performs Whitey’s lip service to gentility as the elaborate pose that it was, assisting the old ladies of Southie with their groceries, while his squinty eyes and carnivorous smile flash hints of the monster underneath.

John Connolly once said that, for law enforcement, running criminal informants was a bit like the circus: “You need to have a guy in there with the lions and the tigers.” In a new book, “Where the Bodies Were Buried: Whitey Bulger and the World That Made Him” (Morrow), the journalist T. J. English makes clear that most F.B.I. agents do not excel in the role. It takes a certain personality type: the garrulous, glad-handing street guy. These agents are often indifferent to official protocol, English points out, and their paperwork can be atrocious. But on a barstool they’re Mozart. In “Black Mass,” Edgerton plays Connolly as a man who thrives on informality. His idiom consists exclusively of backslap and bluster. He’s the guy to see about Red Sox tickets.

The film plausibly depicts the bond that developed between Connolly and Bulger as predicated on neighborhood loyalty. Connolly grew up in Southie and was childhood friends with Whitey’s younger brother, Billy Bulger (Benedict Cumberbatch, in the film), who by the nineteen-eighties had become the president of the Massachusetts State Senate. Vocational options were circumscribed for men who came of age in Southie during the mid-twentieth century: if you couldn’t get a job at the Gillette plant or a utility, your career choices were neatly captured by Connolly (law enforcement), Billy (politics), and Whitey (crime). “Southie kids, we went straight from playing cops and robbers on the playground to doing it for real on the street,” one of Whitey’s underlings says in the movie, adding, “And, just like on the playground, it wasn’t always easy to tell who was who.” Tribalism is a recurring theme in the Bulger saga, but the film suggests that the tribe allegiance of scrappy neighborhood kids transcends any subsequent pledge they might make to a criminal gang, or to the feds. “I grew up with him in Southie,” Connolly says of Whitey. “That is a bond that doesn’t get broken.”

Few activities were more reviled in this Irish-American milieu than snitching. “We loathed informers,” Billy Bulger wrote in a 1996 memoir. “Our folklore bled with the names of informers who had sold out their brethren to hangmen and worse in the lands of our ancestors.” In deference to Whitey’s sensitivities on this point, Connolly never referred to him as an informant. Whitey preferred terms like “strategist” or “liaison.” He told Connolly that he would furnish information about his rivals in the Italian Mafia—but not his friends. And he had another condition: his brother Billy couldn’t know.

Imagine you work at the Central Intelligence Agency. Your objective right now is the fight against the so-called Islamic State, or ISIS. In the past, U.S. intelligence had a difficult time penetrating jihadist groups, because they were bound by ideology, which is stronger than a mutual interest in a shared criminal enterprise, and because they were careful about operational security. But ISIS is different: it actively recruits young Westerners to join its ranks. For the C.I.A., that is a critical opportunity.