Written by William Monahan and based on the Hong Kong thriller Infernal Affairs, The Departed is the story of two Massachusetts men who grow up in similar straightened circumstances but follow diametrically different paths once they reach young adulthood. Colin Sullivan (Matt Damon) grows up fatherless and poor on the mean streets of south Boston. Throughout his youth, Colin is a protg of the Irish Mafia godfather Frank Costello (Jack Nicholson) who keeps Colin's family in groceries when they have no money in the house. When he's old enough, Colin goes to the police academy and distinguishes himself for his intelligence and work ethic. He meteorically rises through the ranks and soon finds himself a detective in the organized crime unit. But all the while, Colin remains on Costello's payroll and regularly supplies his mentor with warnings about any police efforts to gather evidence against him.
Meanwhile, a subsequent Boston police cadet named Billy Costigan (Leonardo DiCaprio) tries to channel his class anger into law enforcement. Billy's beloved father and paternal uncles were all blue collar union men who defied the corrupt enticements of men like Costello. But after a divorce, Billy's mother married an affluent suburbanite, and Billy finished his education in a privileged world he despised. Billy's anger is explosive and barely controlled, so despite excellent grades and test scores, his police prospects remain iffy. That's exactly why he's recruited by special operations supervisors Oliver Queenan (Martin Sheen) as an undercover operative. Billy's assignment is to infiltrate Frank Costello's mob operation and gather intelligence that will help put the godfather in prison. Billy accomplishes the feat of positioning himself among just a handful of Costello's closest associates a little more expeditiously and conveniently than proves quite convincing, but we willingly suspend our disbelief in order to keep stride with the film's relentless pace. This is a trick Scorsese has used throughout his career. His pictures sustain so much narrative urgency they leave you little time to contemplate passages where the script wears thin.
The careers of our two central figures soon cross. Colin learns that Queenan has a mole in Costello's gang and reports that information to the crime boss. Billy, in turn, figures out that Costello has a rat in the police department's organized crime unit and tips off Queenan to look for the traitor. Shortly, each man is charged with identifying and eliminating the spy in his unit. Both narratively and metaphorically, Billy and Colin are ordered to search for themselves.
Scorsese elicits standout performances from his very high profile cast. Playing against type, Damon illustrates the pitfalls of unexamined loyalty. Nicholson turns evil pronouncements into comedy, relieving the tension with the outrageousness of his ruthlessness. It's a risky performance, but it works. And DiCaprio keeps us rooting for Billy, mixing toughness with convincing vulnerability.
And though the director's trademark concerns about redemption are more muted than elsewhere, identity crises run rampant, and the paranoia all this produces proves absolutely breathless. Queenan warns Billy at the outset that he should trust no one, and by the end, we come to wonder who, if anyone, is ultimately trustworthy. What if, someone who seems to be bad, is actually an FBI plant? That fact may provide him legal protection, but it may not provide him even a moment of moral absolution. And that's finally Scorcese's abiding point. The police and the mob share many traits. In their reliance on bloody force, in their habit of deception, in their self-serving lack of loyalty, they are close to indistinguishable. As the picture approaches its climax, Billy understandably wants out of both.