It's not easy to gather information on criminals and their organizations. For one thing, they're savvy enough to look for wires and recording devices. For another, they often have paid informants inside the law enforcement agency who will tip their hand about any investigation. As such, many investigators try to keep their operations very close to the vest, working only with people they believe they can trust, and not divulging information until absolutely necessary in order to keep the criminals or spy agencies from learning about operations that are out to bust them.
Unfortunately, Poor Communication Kills, and sometimes in fiction, we see organizations accidentally set up situations to bust someone who ends up being part of a law enforcement or government operation themselves. This comes about because two factions within the same organization, or two organizations that theoretically operate for the same goals, didn't talk to each other, and end up conducting operations against one another, with The Reveal, often played for laughs, coming when each side tries to arrest the other. It does have potential for drama, as well. In some situations, it can lead to Mistakenly Attacked Mole. When one branch tries to intimidate the other into backing down (and fails), see Intimidation Failure.
Compare and contrast The Mole.
Compare to Calling the Cops on the FBI, where a suspect deliberately gets another law enforcement agency to interfere with the one pursuing them. May overlap with Jurisdiction Friction.
A Sub-Trope of Flock of Wolves and Right Hand Versus Left Hand. Sister Trope to Colliding Criminal Conspiracies.
As this is typically an ending trope, Beware Of Unmarked Spoilers!
Examples:
- Blue Thunder: Actually subverted. While testing out the surveillance equipment of the eponymous helicopter, one of the operators says he sees a guy dealing dope. The pilot asks if the dealer is wearing a specifically colored beanie. When the operator confirms, the pilot tells him it's one of their own guys running a sting, and that the beanie is to let other officers know they're part of their organization.
- Licence to Kill: James Bond launches an assassination attempt on Latin American drug kingpin Franz Sanchez in revenge for Sanchez mutilating Bond's CIA pal Felix Leiter and murdering Leiter's bride on their honeymoon. Unfortunately, the assassination attempt winds up interfering with a Hong Kong narcotics agency's sting operation to bring Sanchez down legally, resulting in Bond getting captured by the agency's operatives before Sanchez's men tracks them down and launches a raid of their own, killing the operatives. Ironically, Bond is the one credited for exposing the narcotics agency's operation to Sanchez, as well as them taking the fall for Bond's assassination attempt, allowing Bond the opening he needs to infiltrate Sanchez's operations.
- Point Break (1991): Johnny suspects a crew of territorial surf punks to be the bank heist crew known as the Ex-Presidents, and the FBI executes a raid on their house, which results in a gunfight, leaving most of the gang dead. They are then yelled at by a DEA agent who's been deep cover with them investigating their drug-dealing operation, with the deadly raid cutting off the ability to trace their suppliers.
- Cherub Series: In the Batman Cold Open of The General, James is infiltrating an anarchist organization attempting to purchase bombs from a former IRA member. Just as the deal falls apart, the MPS counter-terrorism unit storms the building and arrests everyone, including James; unbeknownst to CHERUB or MI5, the MPS had their own undercover investigation into the anarchist organization's leader and former IRA member happening at the same time.
- Eisenhorn: Xenos: Gregor is undercover as a merchant named Farchaval when a Chase Scene ends in the death of his target Effries Tanokbrey. That night, his apartment is raided by another Inquisitor, Commodus Voke, who was separately pursuing Tanokbrey and learned that "Farchaval" had been involved in his death. They initially get into a fight before learning they're both Inquisitors and grudgingly team up to continue the investigation together.
- Burn Notice: "Mind Games": Team Westen is trying to get rid of a Loan Shark named Carter harassing a shopkeeper, and decides to plant documents that frame him as an undercover cop so his boss will get rid of him for them. Unfortunately, when they execute the Frame-Up, the boss looks for a hiding place somewhere they didn't intend, and discovers Carter really is an undercover cop. The team suddenly has to scramble to save his life.
- Castle:
- Zigzagged in "A Deadly Game". Castle and Beckett find a pen with a recorded message in it while investigating their Victim of the Week, leading them to conclude he was a spy. When they follow the instructions in the pen, hoping to learn why the man was murdered, they bust a man named Hans Brauer (played by Mitch Pileggi). Hans tells them that in a short while, they will get a phone call from someone much more important than them, and that they will then reluctantly but contritely release him. They're both creeped out by his ice-cold demeanor. It turns out Hans is not a spy or the killer, but a participant in a spy-cation game, who thought his arrest was part of the scenario. When he learns the truth, he becomes a nervous wreck and directs the group to the company that does the spy-cations.
- In "An Embarrassment of Bitches", after dog trainer Francisco Pilar is murdered, Beckett and Espisito go to check out a warehouse tied to him after learning he'd received several large payments from an unknown source, and investigating if he was smuggling drugs. The man they meet there tells them Pilar was breeding a new dog, and the payments were for puppies from the first litter. However, when that story falls apart, they bring the man in for questioning, and then he claims that he's actually Customs Enforcement. Pilar had trained their drug-sniffing dogs, and the cartels were losing tons of money to them, so they wanted Pilar dead, and the Customs agent had lied because in his line of work, it's difficult to know who you can trust, especially after Pilar was already murdered.
- In "Need to Know" the Victim of the Week turned out to be working for the CIA. He fell in love with the niece of the Russian mobster he was spying on and tried to get her away from her family. The CIA tries to shut down the murder investigation to avoid tipping off the Russians, but the cops investigate anyway and discover the Russians weren't involved in the murder and the CIA's operation won't be affected. After the murder case was closed, the CIA tried to use the niece as a spy, threatening her with revealing her relationship with a CIA asset to her family. Beckett leaks a false story to the media about the niece being under investigation so her family will cut ties with her, making her useless to the CIA.
- CSI: "Mea Culpa". While investigating a shooting, Sara and Warrick discover that the "victim" had been modifying a semi-automatic to be fully automatic. They discover the man had a buyer lined up, and go to bust the buyer, who doesn't know the man making the illegal conversions was dead. Only it turns out that the "buyer" was also law enforcement, specifically ATF, looking to bust the man for making illegal weapon modifications.
- Diagnosis: Murder: A Mime is a Terrible Thing to Waste. Primarily due to the meddling of Randy Wolfe, Mark and Steve end up investigating Sonny Burnett, a buissiness man selling stolen car parts to sell for Duke Fallon out of a belief that the titular mime was killed by Fallon as a threat to Burnett. Thanks to Randy this almost gets them busted by the FBI, who were also investigating Burnett and Fallon, believing Randy, who had stolen Steve's badge to threaten Fallon, was a corrupt cop working for Burnett. Once Steve is able to convince them of what was going on, he works with the FBI to set up a sting to arrest both Burnett and Fallon... only for Burnett to reveal he was actually Jack Crocker, a LAPD detective who had gone undercover to take down Fallon and a whole string of criminals, which was wrecked by the sting. To add insult to injury, the murder had nothing to do with either of them.
- Get Smart: In "Double Agent", Max infiltrates a KAOS group to bust the KAOS agents. However, when he attacks the agents, shooting at least one, as they enter the room, each of them identifies themselves as agents of various other law enforcement and intel organizations, like the FBI, the CIA, Naval Intelligence, and even Scotland Yard. It turns out that KAOS had been cleared out ages ago and restaffed, unbeknownst to each group, by spies trying to bust KAOS.
- Leverage: Exploited by Nate in "The Runway Job". Tara had cleverly signaled to him to involve the cops in their takedown of the mark, so when Nate returned to exchange what the mark believed were fashion designs for Tara's safety, the cops showed up to arrest them, and Nate had brought credentials so that when the cops were about to arrest him he told the lead officer that he was conducting an undercover sting. Having the man look at the phony credentials he had on him (which past episodes had established were convincingly crafted by Hardison), he tells the officer not to blow his cover by making the arrest "look good" and slipping him out the back. The officer, believing Nate to be a fellow law enforcement, plays along.
- M*A*S*H: The Season 2 finale, "A Smattering of Intelligence" has Col. Flagg of the CIA and Col. Pratt of G2 each infiltrate the 4077th M*A*S*H looking for communist subversives. According to Pratt, an old friend of Trapper's, each side is trying to make a big bust ahead of Congressional appropriations so their respective organization will get a bigger cut of the pie. Both try to bust Maj. Burns on evidence that Hawk and Trapper faked up to make each side look foolish. Pratt takes it in stride. Flagg marks Hawkeye as a nemesis from that point on.
- Night Court: In "The New Judge", Dan is offered a bribe by a judge filling in for Harry while the latter is on vacation. The new judge, Watson, tells Dan he can make a lot of money throwing cases. Dan, horrified, runs to report it, but the agents in charge tell him they need evidence and press Dan into service, wiring him with a microphone. Dan manages to get a bribe offer from the judge, at which point armed men burst into the room, only they throw Dan to the floor to bust him! Then the agents Dan was working with burst in. The agents know each other, and reveal that each side had their guy wired, as Dan was also being investigated for corruption. Realizing the mistake, both sides laugh about it, even as they're still standing on Dan's neck.
- Sacred Games: In an effort to save Nayanika from Bunty's clutches, Sartaj makes a deal to lie to the hearing board and get Parulkar exonerated of Junaid's murder in exchange for getting other Mumbai Police officers to rescue her. Unfortunately, this interferes with RAW's plan to extract Bunty and Nayanika in exchange for information on the event Gaitonde mentioned. It ends up in a total disaster, with both Bunty and Nayanika dying, meaning everyone is still in the dark and Junaid's family will never receive justice.
- Spooks: One episode centres on the tragic outcome of such an instance. Zoe was undercover investigating the Turkish mafia, and in the course of her investigation she goaded the henchman she was seducing into confronting his boss. Unbeknownst to her or MI 5, the Metropolitan Police had their own officer undercover in the organisation, who was also killed along with the boss. The episode centres on her being on trial for his death.
- The Wire: The Baltimore Police Major Crimes Unit's investigation into The Greek and his smuggling operation is hampered by the fact that The Greek is secretly a protected informant for FBI Counter-Terrorism Agent Koutris, who calls him immediately after FBI agent Fitzhugh calls him to ask about one of The Greek's associates. Later, when the warrants for the Baltimore cops' raid on the smugglers are entered into the system, an alert pings on Koutris' computer. He signals an order to shut everything down and for the crew to destroy as much evidence as they can, and The Greek and his right-hand man Spiros disappear using new passports.
- BattleTech: The Draconis Combine has constant issues with its Internal Security Force with pretty much every other security and intelligence agency it has: DEST (the Draconis Elite Strike Team, which is more military), the Order of the Five Pillars intelligence agency, and the local police. It's not uncommon for the ISF to find itself in actual shootouts with one of the other agencies, which is made worse due to the Black Dragon Society routinely infiltrating one or more of the agencies, resulting in the other agencies having to go after them when discovered.
- Alpha Protocol: Mike Thorton is in Taiwan trying to stop the assassination of the Taiwanese president, and comes into conflict with Chinese agent Omen Deng, who quickly becomes the main suspect. After the boss fights with him, Mike can piece together that Omen is a double agent that is actually working for Taiwan, and he was led to believe that Mike was the assassin. They both realize they were set up too late to stop the assassin from taking the shot, but if Mike had warned him ahead of time, the President could live.
- Codename: Kids Next Door: Under the pretense of hunting down Numbuh 206, Numbuh 86 and the girls of Sector V travel to the Delightful Children From Down The Lane as KND intelligence believes 206 is fleeing to them to escape decommissioning in the episode "Operation F.U.G.I.T.I.V.E". The trio manages to capture 206 after a long scuffle, and 86 personally delivers him back to galactic headquarters. Unfortunately, unbeknownst to Numbuh 86, Numbuh 362 just so happened to also be infiltrating the DCFDTL's mansion wearing an extremely similar outfit as the rogue agent, so 206 got away and 362 was unable to obtain any information before she was mistakenly captured.
- On June 2, 2009, a building superintendent in New Brunswick, New Jersey (home of Rutgers University's main campus) frantically called 911 after some routine inspection of an apartment revealed a massive amount of photographs of nearby buildings and of suspected Muslim terrorists, plus sophisticated radio monitoring equipment from the NYPD and plenty of literature about Islam. The FBI was quickly called in and raided it, revealing that it wasn't a terrorist hideout as had been feared — it was actually an undercover NYPD surveillance operation that was targeting Muslim student groups outside New York City. Neither the local police nor the FBI had any idea about the NYPD's presence (the CIA did, however, due to the extensive cooperation between them and the NYPD following the 9/11 attacks, but the FBI and CIA aren't generally keen on keeping one another in the loop).
- On November 9, 2017, in Detroit, a group of undercover cops posing as drug dealers attempted to arrest another group of undercover cops posing as drug buyers. Neither group knew the other, and the misunderstanding led to a brawl between two dozen armed officers.
