In "The Departed," cop Billy Costigan (Leonardo DiCaprio) infiltrates mob boss Frank Costello (Jack Nicholson), while fellow officer Colin Sullivan (Matt Damon) is a mob informant.
Eventually, Costigan and Sullivan both find out about each other’s secrets. They meet but are interrupted by another officer, Barrigan (James Badge Dale), and Costigan is killed.
Barrigan reveals to Sullivan that he was also a mole working for Costello. After this admission, Sullivan kills Barrigan, makes up a cover story, and goes on with his life.
The final sequence of "The Departed" shows Sullivan coming home from the store, only to be ambushed by his police superior, Dignam (Mark Wahlberg), who shoots and kills him.
The other possible reason is that Dignam was working with the FBI and knew about Sullivan's betrayal. He would want to cover up the FBI’s knowledge of corruption.
The last shot of "The Departed" has inspired no shortage of controversy. After Sullivan drops dead and Dignam walks away, the camera pans to a rat crawling across a patio railing.
Some fans found the metaphor too exact, as "rat" is slang for someone who betrays the trust. One fan even created a crowdfunding campaign to digitally remove the rodent.