WARNING: The presence of any work on this list may well constitute a spoiler.
Among the various cops, forensics people, etc., working on a crime scene in fiction, there's a good chance that one person on the team will know a lot more about what happened than everyone else present ... because they committed it.
In real criminal investigations, it's not uncommon for the offender to somehow attempt to insert himself/herself into the investigation to keep tabs on it, or for ego's sake. In this trope, it happens that the offender is actually an official part of the investigation, and is quite probably cheerfully leading Detective Patsy astray as much as possible.
This applies to any crime. The defining characteristic is that one of the investigators is in fact the perpetrator, whether the audience knows it or not. Compare Bruce Wayne Held Hostage, Hired to Hunt Yourself.
No connection whatsoever to Hanna-Barbera cartoon star Morocco Mole, who is an assistant detective who happens to be a mole.
Again, spoilers below. This is your warning. Proceed at your own risk.
open/close all folders
Anime and Manga
Death Note. It isn't a particular murder, but a massive supernatural killing spree...but the killer is still called in to investigate.
Though this is because L, the lead detective is the world's best three detectives, and has called in Light, both because he is useful as a detective, and because he has a high probability of being the killer, presenting the chance for the lead detective to get into his mind. This was his stated purpose in bringing in Light.
Played straight in Death Note: Another Note. Naomi Misora is very impressed with Ryuuzaki's ability to decipher Beyond Birthday's codes when no one else can—of course it's because "Ryuuzaki" is Beyond.
In Saw IV, Detective Mark Hoffman is revealed to be Serial Killer Jigsaw's second protégé.
In Ocean's 12 and 13 an Interpol agent (in 12) and the main FBI agent investigating the gang (in 13) turn out to be respectively Linus' mother and father, and actually help the con.
In Ace Ventura, a murder and two kidnappings (one dolphin and one Dolphin) were investigated by police chief Lois Einhorn.
Judge Doom is ostensibly the one looking for the one responsible for murdering Marvin Acme in Who Framed Roger Rabbit. He's the one who committed the murder. What's more, he also kills R.K. Maroon before he spills the beans. And was the one behind the company buying Maroon Studios and the Red Car. And was the one who killed Eddie's brother all those years ago. Moreover, he did all this so that he could destroy Toontown and build a resort area next to the soon-to-be completed freeway. (And, according to one of the first drafts of the script, he was the one who shot Bambi's mother!) That's one seriously disturbed toon.
In The Sting the FBI agents who assist Lieutenant Snyder in his pursuit of Robert Redford and convince him to help their investigation are revealed to be the final part of the sting.
With the exception of John Hartigan, every cop in Sin City is working for the bad guys. The only difference is that there is no reason to keep it a secret.
In No Way Out, the three main characters involved in the investigation of a Pentagon-related murder that is blamed on a supposed Soviet mole are each guilty of a crime. One is the actual murderer, another is helping him frame someone else for said murder, and the third is an actual Soviet mole.
Horns movie adaptation features a variant of this. Ig Parrish is accused of the rape and murder of his girlfriend, which had been committed by Lee, who is Ig's best friend and lawyer. Lee actually tries to frame Terry (Ig's elder brother) as the culprit.
Mackerel by Moonlight, whose real claim to fame is that the author was governor of Massachusetts until right before it was published.
In Val Mcdermid's The Distant Echo, four students literally stumble upon the body of a young woman, and are immediately suspected of the crime. The reader is lead to wonder if it was one of them who killed her, and in that case who. As it turns out, the real killer is the first police officer on the scene.
The murderer in Isaac Asimov's The Caves of Steel is in charge of the investigation, and specifically picked his old friend, the main character, to handle it.
In the Lord Darcy novel Too Many Magicians, the true identity of the murderer/Polish spy known as 'Goodman Fitzjean' is Commander Ashley, the Naval Counterintelligence officer assigned to track Fitzjean down.
Time Scout: Sid Kaedermann insinuates himself into the rescue mission for his own victims.
This happened when a police inspector was covering up evidence at the scene of crimes his organization had committed until he was stopped by the Shadow.
Fred Vargas' novels have two examples so far.
In This Night's Foul Work, Ariane Lagarde, a highly-respected forensics expert deliberately misleads the whole investigation team by setting up a false but very convenient culprit. Adamsberg and Danglard do think that someone connected to the crimes is in their team... but they spend most of the book suspecting Lieutenant Veyrenc.
In The Ghost Riders of Ordebec, the Ordebec murderer is none other than Louis-Nicolas Emeri, the gendarmerie officer initially in charge of the investigation.
In Arsène Lupin in Prison, the Inspector Ganimard from the first half of the story, hired by Baron Cahorn to stop Lupin's newest scheme, is an impostor employed by Lupin, as opposed to the real Ganimard who visits Lupin in jail in the second half of the story.
In Memory by Lois McMaster Bujold, the ImpSec head Simon Illyan is poisoned by Lucas Haroche, one of his direct subordinates and effectively his second-in-command. Haroche doesn't lead the investigation personally, but he does decide who is on it, its scope, and who can contact Illyan.
Live Action TV
In the first-season Dexter episode "Return to Sender", Dexter gets called to the scene of one of his own murders.
And again at the beginning of the third season where Dexter takes someone through how their brother was killed. Beforehand he had the opportunity to pick up some evidence he dropped.
In fact he was called in when someone mistakenly tried to copy Dexter and ended up in several trash bags. Actually looking over his own crime scenes happens a lot.
Oh yeah, and then there's the entire second season, which Miami Metro PD and the FBI spent looking for the Bay Harbor Butcher and Dexter spent evading them.
In season 3 of Nip/Tuck, serial killer The Carver turns out to be Quentin Costa and Detective Kit McGraw, who's investigating the case, is his sister and accomplice.
The third episode of Pushing Daisies has Ned called in to investigate the "accidental involuntary manslaughter" he was responsible for in the first episode.
Memorably used in the pilot episode of Hustle, in which the lead investigator uncovering the crew's confidence schemes is actually a fellow conman, who vanishes with all the cops' evidence before his ruse is uncovered.
In the Columbo episode "A Trace of Murder," the killer is a crime scene investigator.
In the Season 1 finale of Damages, the man who killed the protagonist's fiancee is seen returning to the crime scene to recover a crucial piece of evidence left behind by his accomplice. As he snatches the evidence up and pockets it, one of the cops investigating the case bursts in on him... and greets him as a fellow detective, introduces him to the protagonist, and offers to show him around the crime scene.
There was an episode of Monk, "Mr. Monk and the Captain's Marriage", where the killer turned out to be a cop who claims to be sleeping with Stottlemeyer's wife. (He'd lost a tooth down a grate in a fight with the victim, and he needed Stottlemeyer to punch him in the face so that when the tooth was found at the crime scene it wouldn't incriminate him.)
In the Psych episode "Psy vs. Psy", Shawn competes with a rival psychic who turns out to be getting her information about a robbery from having been in on the crime. When Shawn puts the amount of stolen money much higher than she does, she realizes her partner is going to double-cross her, kills him, and shows up to investigate the murder. At the crime scene, she touches the body while "psychically reading" it to explain the presence of her DNA.
Methos from Highlander, as he's in charge of the division of Watchers who are trying to find him.
This happens in a MADtv sketch about what it would be like if psychic detectives were real. The medium examines the scene, declares it a perfect murder with no clues, gets a psychic impression, and immediately and easily divines that the investigator did it. Busted.
Midsomer Murders has one where a large sum of money goes missing, with two Jerk Ass "special ops" types are sent to help. Troy immediately sucks up to them, despite their contempt. In the end, it turns out they were in on the heist, with their own boss masterminding (and having done the murders, which wasn't part of the plan).
Sgt. Trevor Gibson in "Sleeper Under the Hill" turns out to be involved in the killings and does his best to throw Barnaby and Jones off the trail. He ultimately falls victim to his partner in crime.
The detectives on the "Strike Team" on The Shield were made to investigate the robbery of a money laundering operation which they were responsible for.
Played with in the 5th season of The Wire. Two detectives fake a series of murders of homeless men using bodies recently deceased of natural causes, and end up investigating their own staged crime scenes. Instead of attempting to cover up their work, the aim is to bring publicity to the "killings" in order to restore police funding.
Also, an unscrupulous reporter fakes having received a phone call from the imaginary killer in order to further his own career, much to the "mastermind's" surprise; who then decides to call the reporter for real as the killer to bring in even more publicity.
In an episode of Sabrina the Teenage Witch, the cast took part in a magical murder mystery party, with Sabrina acting as the detective. Much to her own surprise, she turned out to have committed the crime at the end of the episode.
In one episode of The Closer, a man who killed two of his girlfriends in the late 90s, but was never convicted because the bodies weren't found, is murdered. The man who lead the first investigation, a Detective Olin who has since retired, is asked to come in and help them with the new murder, because of his insight in the original case and his close relationship with the families of the victims. In the end, it turns out Detective Olin is dying and, desperate to solve his That One Case, killed the man after torturing him until he revealed where he buried the bodies.
In the Leverage universe, the actual, real-world never-solved mystery of D.B. Cooper was never solved because... basically right after landing, D.B. Cooper got himself into his own investigation, tampered with the evidence, and then spent the rest of his life as a completely legitimate FBI agent.
Happens several times on Babylon 5, due partially to the fact that the eponymous station is where folks go (at least earlier in the show) when they get Reassigned to Antarctica. Many of the security guards work there simply because they had nowhere else to go, and more than a few are easily bribed. The most notable example, however, would be Garibaldi's assistant Jack, in the first season.
In the Thriller adaptation of Robert Bloch's "Yours Truly, Jack the Ripper," the Ripper is actually Dr. John Carmody, the psychiatrist consulting for the police investigation of the latest string of murders.
In Kojak's second episode, "Web of Death," a police detective murders his wife's lover and gets himself assigned to investigate the case. Unluckily for him, his usual partner comes down with appendicitis and he gets paired up with Kojak, who quickly sniffs out the truth.
In an episode of Foyle's War, the killer of the second victim is the detective who's taken over the case Foyle was working on, Foyle himself having been unexpectedly suspended on a flimsy charge that comes down to a case of mistaken identity. It turns out that the other detective set him up for a chance to get at his own victim (It's Personal), who lives near where the investigation is taking place. Foyle's efforts to clear his own name and get back to work conveniently lead to a Eureka Moment about the other detective.
Michael in Burn Notice does this often when he gets hired by the bad guy to find out who is after him (more often than not being Michael himself). One notable one is when he is hired to be a Spy Hunter and pretty much has a blast suitably suggesting it could be him to the mark.
On Justified US Marshal Raylan Givens tends to run into those types of moles. In season one Sheriff Hunter Mosley turns out to be working for a Miami drug cartel and is called in to investigate when his relative botches a hit on Raylan. In season 2 it is an Open Secret that the Benetts are the biggest marijuana growers in the state and Sheriff Doyle Bennett regularly investigates and covers up crimes committed by his brothers. In season 4, the FBI agent in charge of investigating the Tonin crime family has been on their payroll for years. When Raylan goes looking for fugitive Drew Thompson who disappeared in Harlan County 30 years ago, he is helped by new sheriff Shelby Parlow who not only is reluctantly working for crime boss Boyd Crowder but also is Drew Thompson.
In the second season of Forbrydelsen, Lund's new sidekick Strange is the killer.
In the Vocaloid song "The Riddle Solver Who Can't Solve Riddles", the detective (played by Len) initially appears to be unmasking the girl (played by Rin) as the culprit of the murders. However, in the end, the detective reveals himself to be the actual killer.
The board game Clue, possibly (and definitely if you're playing with six players).
Hilarious in the SNES version, where a cutscene will play out where the winner deduces the killer and the killer gets taken away by the cops while cursing the winner. "Prof. Plum: The killer was Prof. Plum. [...] Curse you, Prof. Plum!". Also, that apparently still counts as a win.
Mr.Green:I won, I won! I may be going to jail, but I won!
The Bat reveals in the end that the man who introduced himself to Cornelia in the first act as the detective Mr. Anderson is actually the Bat, who beat up the real Mr. Anderson and tied him in the garage.
Luke Atmey in Ace Attorney, not actually the thief he was looking for, but he was the mastermind behind his heists.
Also Tyrell Badd, one leg of the Yatagarasu in Investigations, who made sure to be the detective assigned to the Yatagarasu case specifically to destroy any evidence his partners left behind.
If we're adding in lawyers (who practically function as detectives in the games), we have smuggling ring moles Calisto Yew and Jacques Portsman, the former was also one of the Yatagarasu.
Not to mention Manfred von Karma, Damon Gant, Daryan Crescend (according to Word of God), Byrne Faraday, Bansai Ichiyanagi and Bobby Fulbright. And special credit for Furio Tigre and Kristoph Gavin, who manage to be moles while being detective-lawyers for the defense.
Scott Shelby (the Origami Killer) from Heavy Rain, who is pretending to be a private eye hired by the victims' families so he can get access to and dispose of any evidence that implicates him.
In Doom House, Officer Cop is initially introduced as the dispatched police officer responding to Reginald P. Linux's 911 call, but he turns out to be the one responsible for the horror Linux is experiencing inside the doom house.
"Why, I've been the killer all along [...] But how?"
"Remember when you stabbed this guy... five minutes ago?"
Dan Vs.: In the episode "Dan Vs. Elise's Parents", Dan tries to get Elise's father arrested by manufacturing evidence that he's the head of the mafia. This evidence is enough to convince the police to open their own investigation. The detective they send turns out to be a mole, working for the real mafia.
Dr. Harold Shipman wrote the death certificates for his victims, to make the deaths out to be natural.
FBI agent Robert Hanssen, who sent enormous amounts of intelligence to the Soviet Union and later Russian Federation during a career as a spy that lasted over twenty years, was at one time head of a task force charged with ferreting out the suspected mole in the FBI—himself.
FBI agent John Connelly was involved in helping mobster James J. "Whitey" Bulger get away with his crimes for as long as he did. Colin Sullivan in The Departed was loosely based on him, while Frank Costello from the same movie is based on Bulger. Connelly is currently in a Massachusetts prison for a 40 year sentence after serving a 10 year sentence in Federal prison. It was partially thanks to him that Bulger was able to escape as a fugitive for as long as he did.
Kim Philby was head of the counter-espionage section MI6 for two years, while all the time he was a spy for the Soviet Union, and thus charged with stopping himself before he defected.
Philby and his colleagues blew the cover of several British intelligence officers, one of whom would go on to write spy novels under the name John le Carré. Tinker, Tailor, Soldier, Spy is a fictionalized version of the whole affair.
Dennis Rader, the B.T.K. Killer, took a job for the security firm ADT Security Services shortly after beginning his series of murders. Part of his job was installing home alarms, and they were sometimes touted as helping protect people from B.T.K. He once reported one of his own murders to the police from a phone box just a few blocks from his offices. In addition, during this time he was studying for a degree in Criminal Justice- he wanted a thorough knowledge of law enforcement procedure.