“I probably could be you. I know that much. But I don’t want to be you.”

Leonardo DiCaprio, playing Billy Costigan, a street-smart Boston gangster–and secret agent for the Massachusetts State Police–says these words to Jack Nicholson, playing organized crime kingpin Frank Costello, in Martin Scorsese’s 2006 crime masterpiece The Departed. It’s within the context of the story, but perhaps there’s just a bit of literal truth in the line, from a great actor of one generation to another. Especially in the decade since The Departed‘s release, DiCaprio, who finally won his long-awaited Best Actor Academy Award for 2015’s The Revenant, has become perhaps the greatest actor of his generation. Jack Nicholson already is the greatest actor of his generation. The two of them came together in a remarkable film that turned out to be a victory lap not just for them, but for iconic director Martin Scorsese as well.

The Departed is a story about crime, punishment and deception. Two brilliant and driven young men, Billy Costigan (DiCaprio) and Colin Sullivan (Matt Damon), join the Massachusetts State Police. Both go undercover, but in different ways. Costigan, working for Captain Queenan (Martin Sheen), pretends to turn to a life of crime in order to infiltrate the organization of Frank Costello (Nicholson), the city’s biggest–and most untouchable–gangster. Meanwhile Sullivan, who grew up in Costello’s neighborhood, is a state trooper, but he’s also a mole for Costello. Each commander–Queenan and Costello–begins to realize that the other has a “rat” in his operation, but no one knows who it is. As Costigan and Sullivan come closer to finding each other out, they each connect romantically with the same woman, police psychiatrist Madeline Madden (Vera Farmiga). The result is a tense, bloody, suspenseful but surprisingly emotional roller-coaster ride, directed with Scorsese’s expert touch.

Powerful performances by Jack Nicholson and Leonardo DiCaprio anchor the epic gangster film The Departed.NSFW language.

When it came out in 2006, The Departed was much-discussed as Scorsese’s “second chance” to win the Academy Award for Best Director that many think he should have won for 1990’s GoodFellas, another crime epic. But The Departed is far from just “GoodFellas 2.0″ or “GoodFellas in Boston.” In fact it owes little to the 1990 film other than the fact that it also involves gangsters. The real issue in The Departed has to do with identity. What are the lies we tell to ourselves, the masks we wear out in the world? Why do we pretend to be people we aren’t? The Departed plays with these very personal questions, and its smart script (by William Monahan) and expert direction makes it seem the film is much more concerned with these issues than with the convoluted police drama that would be the exclusive centerpiece of a lesser film. Indeed Scorsese treats the rival-moles plot–which comes from a 2002 Hong Kong film called Internal Affairs, of which The Departed is technically a remake–as little more than set-up, a neat scenario to drill into the heads of the characters. This is why it’s such a brilliant film.

This is a perfect late-career film for Jack Nicholson. He doesn’t play Frank Costello much different than any of his other roles as arrogant alpha males, except perhaps a bit more psychotic: clowning with a victim’s cut-off hand, powdering his nose and face with cocaine, even casually emerging with bloodied clothes from the back room of a restaurant that’s a front for the mob–and not saying a word about what’s going on back there. But he’s clearly having fun with the role. Nicholson gives the impression that finding this character is effortless. After 60 years in the movies, it probably is. Nicholson’s character is ostensibly based on real-life Boston boss “Whitey” Bulger, who the feds finally nabbed in 2011–revealing that he had been an informant for the FBI for decades (which, spoiler alert, is true of Costello in the film too). There’s a certain glory to his villainy. No one else but Nicholson could do it.

More intense performances! Vera Farmiga earned universal praise for her role as a police counselor. She works well with DiCaprio. NSFW language.

The other performances are great too. DiCaprio had numerous breakout roles during the 2000s–The Aviator, another Scorsese picture, chief among them–but the role of Billy Costigan showcases his intensity more than any other in his career up to this point. I’m less a fan of Matt Damon than I am of DiCaprio, but his performance as Colin Sullivan is right-on. You kind of hate the guy instinctively even though there are things to like about him. Mark Wahlberg is utterly caustic as an angry, profane police agent, but his character is also supposed to have a lot of integrity, and it shows through. Most amazing is Vera Farmiga, whose turn as Madeline earned her widespread critical acclaim.

I also love how the city of Boston is a character in the film in its own right. The visual and physical backdrop of The Departed shows us Boston’s dive bars and cheap convenience stores and its tough Irish neighborhoods steeped in class resentment, as well as its swanky restaurants and waterfront condos. Even the soundtrack reinforces the location; the Dropkick Murphys’ raucous anthem “I’m Shipping Up to Boston” is the film’s unofficial theme song. That Scorsese could make such a sense of the city seep through the picture is doubly amazing because not much of The Departed was even filmed in Boston! Some establishing shots were, but a lot of it was made in New York City, mainly for financial reasons.

One of the tense scenes in The Departedshows opposing “rats” Costigan (DiCaprio) and Sullivan (Matt Damon) slowly closing in on each other. NSFW language.

The Departed is a great film. It does not, as many people thought in 2006, suffer in comparison to GoodFellas; I don’t even really see the point of the comparison. It’s a crowning triumph for Scorsese, Nicholson, DiCaprio, Farmiga and just about everyone else connected with it. I suspect it’ll become sort of timeless in the pantheon of great grime and gangster films through the ages. At that point in his career you’d expect nothing less from Martin Scorsese.