The Departed, based on 2002’s Infernal Affairs, begins many years ago in South Boston. We find Colin Sullivan as a young boy being introduced to the Irish-American mob boss Frank Costello. Over the next few years, Costello grooms him to be his personal mole inside the Massachusetts State Police. Eventually, the Special Investigations Unit that focuses on organized crime accepts Sullivan to their team.
Meanwhile, Captain Queenan and Staff Sergeant Dignam recruits William “Billy” Costigan Jr. as he’s about to graduate from the state police academy. They want him to go undercover for them as his family’s ties to organized crime make him their perfect mole. He agrees, and to make his cover more believable, he drops out of the academy, and serves time in prison for a fake assault.
Both moles set out to infiltrate their respective organizations, and for Sullivan, one of the perks is that get gets to date police psychiatrist Madolyn Madden. Coincidentally, she becomes Costigan’s psychiatrist as a condition of his probation, and THEY begin a relationship too!
When Costello escapes a sting operation, each mole becomes aware of one another existence, but they do not know their true identities. Costello immediately orders Sullivan to find the rat, and the police look to find out on their side too.
Costigan tails Costello to XXX theater where Costello meets with Sullivan. Costello gives him an envelope containing the personal information on all his cronies. Once Sullivan leaves, Costigan tails him through Chinatown, but neither man spots the other’s face even though they know they are being observed. However, Sullivan does stabs a truck loader he thinks is the one following him.
Later, Sullivan tails Queenan to the roof of an empty building as he meets with Costigan. Sullivan tattles to Costello, who sends his men up the building to say hi. When Costello’s men do arrive, Queenan tells Costigan to beat it, and he faces the thugs alone. The men wind up tossing Queenan off the roof where he falls to his death. As the men flee the building, Costigan appears, and pretends he’s there to help.
During their escape, there’s a shootout with police. They shoot and kill one gang member named Delahunt. The news report reveals that Delahunt was an undercover cop for the Boston Police Department. However Costello not only doesn’t believe the story, but he’s pretty pissed his boys couldn’t properly take care of that body.
After Queenan’s death, Sergeant Dignam gets in a confrontation with Sullivan. Captain George Ellerby places Dignam on a leave of absence, but he quits instead.
Later when Sullivan finds Queenan’s phone, he contacts Costigan, and tries to get him to quit. Costigan refuses to abort it though. Sullivan also learns from Queenan’s diary that the FBI lists Costello as a protected informant. This is sufficient enough to cause him to worry about his own cover being blown.
Costigan does tip Sullivan off to a cocaine drop-off with Costello and his men. When the police show up, a shootout begins between Costello’s men and the cops; leading most of Costello’s gang dead.
Sullivan is there, and he confronts Costello about being an FBI informant. Costello pulls a Han Solo, and tries to shoot him first, but Sullivan shoots him multiple times instead, and he falls to the ground dead. The next day, his coworkers applaud the mole as their hero.
In a show of good faith, Costigan agrees to meet with Sullivan at the station where he will reveal his true identity and collect some back pay. After some idle chit chat, Sullivan leaves the room to look up Costigan’s employee record. As he’s doing so, Costigan notices the envelope Costello gave Sullivan at the theater on his desk. Realizing that Sullivan is Costello’s mole, he quietly leaves before Sullivan returns. With Sullivan’s cover completely blown, he deletes Costigan’s records from the system for good measure.
What Sullivan is still unaware of is that Madolyn and Costigan had an affair. She’s now pregnant with a little boy, but who is the father? A few days pass and Sullivan finds Madolyn listening to a CD Costigan mailed her. It contains incriminating conversations Costello recorded between himself and Sullivan, and now Madolyn knows he’s not the good guy she thought he was. Although he tries in vain to convince her otherwise, he knows she knows, you know?
With limited options, Sullivan reaches out to Costigan one last time. He tells Sullivan that Costello recorded each and every one of their conversations, and that his attorney gave him full possession of the tapes. Costigan plans to have Sullivan arrested as the mole, and the two agree to meet at the same building where Costello’s boys murdered Queenan.
Once there, Costigan pulls a fast one, and quickly handcuffs Sullivan. Officer Brown, someone who went through the academy with Costigan, arrives to the roof top too at Costigan’s request. Seeing Sullivan in handcuffs surprises Brown, and he pulls his gun on Costigan. Costigan tells Brown the truth, and then leads Sullivan to the elevator, while Brown takes the stairs down. When the elevator reaches the ground level, the doors open to Officer Barrigan standing there. He shoots Costigan in the head, and he falls down dead. When Brown arrives, Barrigan shoots and kills him too.
Barrigan tells Sullivan that Costello actually had two moles working there, and he’s the second one. He wants Sullivan to escape with him, but Sullivan isn’t willing. Sullivan shoots Barrigan dead instead, so he can reveal Barrigan as the mole the police have been looking for. He also has the police force posthumously award Costigan the Medal of Merit.
At Costigan’s funeral, where he’s posthumously awarded the Medal of Merit, Sullivan sees Madolyn in tears. He tries to ask her about the baby, but she won’t talk to him. Sullivan heads off to the grocery store, and when he returns home to his apartment, Dignam is waiting there for him. He shoots Sullivan dead as he enters the room.