First, a few small bits of business to get out of the way. Is Black Mass as great a film as, say, Goodfellas? No, of course it’s not. Will some of its themes and formulations be familiar to moviegoers who have watched their share of mob cinema and of films set on the South Boston? Yes, they will.

But for those willing to grant these (perhaps inevitable) allowances, Black Mass is a very, very good film. Directed by Scott Cooper and starring Johnny Depp, the movie tells the true story of James “Whitey” Bulger, who rose to become the most powerful and ruthless crime lord in Boston thanks in large part to his “alliance” with the local branch of the FBI.

The story—largely accurate, though with occasional details rearranged—begins in the mid-1970s, with the return to Boston of FBI Special Agent John Connolly (Joel Edgerton). Connolly, a native of Southie, had known and admired Bulger (Depp) while growing up, and he soon sells his superiors on the idea of turning the crime boss into an FBI informant.

The deal he offers Bulger is rather different in tone, however: The latter won’t have to inform on any of his Irish partners in crime from Southie; instead, he’ll merely help the Bureau take down the Patriarca crime family, a Mafia outfit operating out of the North End—and, as such, a principal competitor of Bulger’s own Winter Hill Gang. As Bulger describes it to one of his men: “It’s a business opportunity: to get the FBI to fight our wars against our enemies, while they protect us and we do whatever the fuck we want.” The only catch, Connolly stresses, is that Bulger can’t kill anyone.

This detail of the arrangement is, however, flagrantly and repeatedly ignored by Bulger and his gang. As Bulger grows stronger, Connolly and his partner (David Harbour) find themselves ever more deeply enmeshed, to the point that they are working more for the crime lord than for the FBI: doctoring records and tipping him off to threats from other agencies and their own informants, more than one of whom wind up dead.

It is a grim and grisly ride, and over its course Bulger is revealed to be a genuine psychopath. (It is perhaps worth noting here that while serving an earlier prison sentence, Bulger participated in the CIA’s MK-ULTRA program, receiving dozens of doses of LSD and other drugs, which he described as taking him to the “depths of insanity.”)

The role is Depp’s best in many years, and a welcome respite from the parade of prancing pseudo-villains—Mortdecai, the Wolf, Barnabas Collins, Jack Sparrow, Willy Wonka—to which he has devoted far too much of his career. Ashen-faced, with a rotting tooth and deathly blue eyes (accomplished by means of remarkable, hand-painted contacts), he looms and whispers like a Beantown Beelzebub. And if there are occasional echoes in his performance of Pacino, De Niro, Pesci, and Nicholson (whose mob boss in The Departed was based in part on Bulger), they may be unavoidable, and are in any case welcome.

Edgerton’s Connolly makes for a nicely overheated contrast: a local boy made good but all too eager to be made bad again. Slightly puffy and puffed-up when the movie begins, he only grows more so as it unfolds. The supporting cast—featuring Kevin Bacon, Dakota Johnson, Corey Stoll, Julianne Nicholson, Peter Sarsgaard, Juno Temple, and Adam Scott—is exceptionally strong. But perhaps best of all are the actors who make up the rest of Bulger’s crew, fleshy and heavy-lidded as cuts of aged beef: Jesse Plemons, Rory Cochrane, W. Earl Brown. Plemons’s visage—the first we see in the film—is an especially evocative map of accumulated thuggery, the kind of face Matt Damon might have if you dropped him head-first down a well and left him there for a month.

Black Mass is a considerable step-up in scale for Cooper (Crazy Heart, Out of the Furnace ), but his direction is neat and unfussy, stylish without calling attention to itself. In a nice touch, he uses the latter-day testimony of Bulger’s old partners as an effective narrative device: the feeble revenge of underlings grizzled, used, arrested, utterly spent. The insufficiency of their revenge is only highlighted by Bulger’s ultimate flight from justice in 1995. Occasionally spotted (perhaps) around the globe, Bulger wasn’t captured until 2011 in Santa Monica, after 12 years in the number two spot on the FBI’s Most Wanted List—behind Osama bin Laden.

Despite its many strengths, Black Mass has its missteps and omissions. The female characters (wife, mistress, hooker) are sorely underdeveloped, and Benedict Cumberbatch, who plays Bulger’s brother, the 18-year President of the Massachusetts State Senate Billy Bulger, is never quite satisfyingly integrated into the central story. How did this fraternal bond between Boston’s most powerful criminal and its most powerful politician play out? The disappointing truth is that they may be the only two human beings who know, and neither is talking to filmmakers.

Moreover, there are two particular scenes—one recalling Pesci’s “What do you mean I’m funny?” speech in Goodfellas and another reminiscent of Pacino’s baptismal bloodletting in The Godfather—that are too specific in their homage, and serve only to summon unflattering comparisons. Unlike those films, Black Mass is not a classic of the genre. But such comparisons aside, this is a case where it would be unwise to let the perfect be the enemy of the (very) good.