Finding Judas

It's not hard to see the attraction of The Mole or the Face Heel Turn to a TV writer. The shadowy villain who's been plotting for several episodes is revealed - and it's a previously sympathetic character, providing a dramatic twist with just a silent shot of his face. However much inherent drama there is in these tropes, they also pose a big problem in the long term. Having one of the characters turn out to be a villain either rips the heck out of your cast structure, makes your characters look like idiots, or both. Repeat the trope and it's even worse.

Hence the much milder form described here. Something bad still happens, the characters still chase around looking for the culprit, and it's still one of them, plotting behind the scenes. But he's doing it with the best of intentions, hoping that whatever he's done will help them all. Usually he's right, and he's grudgingly thanked. Sometimes he's wrong, and has caused a complete disaster - but he's still not a villain.

Literature

 * The original Judas Iscariot is often considered to have had unselfish intentions—perhaps he wanted to goad Jesus into all-out war with the Romans to liberate the Jews. And the pseudopigraphical Gnostic Gospel of Judas actually claims that Jesus ordered him to do it.
 * Jesus also asks Judas to betray him in The Last Temptation of Christ. Thus fulfilling a vow Judas had made before Jesus took up the role of the Messiah, when he was just a carpenter making crosses for the Romans to crucify Jews upon.
 * Jorge Luis Borges took this a step further, positing a mock-theory that Judas was the real Messiah; Jesus just sacrificed his mortal flesh, but Judas knowingly damned his soul in order to redeem humanity. Since this was presented as the final absurdity of a fictional academic in a fake academic essay, there's no way of knowing how seriously Borges took the idea.
 * The Rock Opera Jesus Christ Superstar portrays Judas as someone who was simply too practical for the radical and mystical elements of Jesus' movement, and overly concerned with the size of the movement possibly drawing attention from Rome. He has not one but two monologue songs where he agonizes over his motives. One needs only to look up the lyrics to "Heaven on Their Minds" to see a clear example of this portrayal.
 * He's also concerned about the Cult of Personality surrounding Jesus, believing the man is putting himself above the movement.
 * There's also the interpretation that, since Jesus' sacrifice was part of the Divine Plan, Judas was an instrument of the will of God. In some dramatic productions (e.g. John Neumeier's ballet) Judas is actually to remorseful to deliver the traitorous kiss, and it is Jesus who deliberately forces it.
 * The play Godspell also takes this route, and if done well, the look on Judas' face as he narrates the betrayal will break your heart. Also slightly different from the above in that Jesus knows what is happening but simply tells Judas "do what you must" at the appropriate moments to push events in the right direction.
 * The Gospel of Luke suggests that Judas was possessed by Satan at the time. Go figure.
 * Which is interesting because in all of his earlier appearances, Satan is depicted as a servant of God. The Book of Job has him asking God's permission to test Job.
 * That only indicates he is subservient to God, i.e. he has no authority and whatever he wants to do he has to get permission.
 * John Brunner's story "Judas" (1967), from Dangerous Visions, retells the story in a futuristic context.

Live-Action TV

 * House provides the name of the trope, from an episode title. Someone sells Dr. House out to the cops. He investigates his sworn enemies (ie the rest of the cast), but it turns out to be.
 * Studio 60 on the Sunset Strip: A question about patriotism is inserted into a focus group, spurring Matt to be even more politically controversial while trying to discover which timid executive was responsible. It was Danny, of course, using reverse psychology.
 * Buffy the Vampire Slayer: What villain called up the undefeatable, lethal, musical demon, and what dark scheme were they plotting? Xander Harris, and he just wanted a musical-comedy ending to all his friends' problems.
 * The West Wing: Who leaked Leo McGarry's terrible debate-preparation tapes to the press? Leo McGarry himself, to lower expectations.
 * Also occurs in a series six-seven subplot where someone in the West Wing leaks details about a military space-shuttle project during a potentially lethal crisis on a space station, which Toby is asked to investigate.
 * When it's not considered Fanon Discontinuity, some fans theorize that
 * There were examples in Sorkin-era episodes too -- "Take Out the Trash Day" (Leo's drug addiction; it was some intern, whom Sam fires with extreme prejudice and Leo kindly unfires); "Enemies" (the president told the vice-president off in a cabinet meeting; everyone thinks it was the VP himself, but C.J. figures out it was the secretary taking minutes); "Bad Moon Rising" (something about the president supposedly changing his position on school vouchers; we never find out who it was, because the whole storyline is a study in Toby's state of mind); and "War Crimes" (a quote from Toby about the president being politically beholden to the vice-president; ditto).
 * Subverted in Murder One: A member of the defense team humiliates the prosecution by "leaking" them a pornographic videotape that looks like a vital piece of evidence. The lead defense lawyer figures out who's responsible for the "leak", has a good chuckle about how it worked out in the end... and fires him on the spot for unethical behaviour.
 * In the season 3 finale of Bones, the mystery of cannibalistic serial killer Gormogon ends when
 * 24. Pretty much any major character fits this trope at some point. Jack does it several times each day.
 * Wesley on Angel trying to prevent Angel from eating his son, as prophecy said he would. Didn't go well.
 * In Dollhouse, the end of the series reveals that  In hindsight, maybe that wouldn't have been such a bad idea.
 * In the Star Trek the Original Series episode "The Menagerie", Spock actually steals the Enterprise, maroons Kirk on a starbase, and then decides to go to the one place in the whole of the galaxy that is considered forbidden territory in the Federation. Turns out he was on a mercy mission. Kirk's response is something like, "Oh. Well, all right then."
 * Star Trek Deep Space Nine: There was a constant fear in Seasons 3 and 4 that Changelings had infiltrated the station. Also, Eddington turns out to be Maquis.
 * Zig Zagged in the new Battlestar Galactica. Virtually every plot in the series revolved upon who was betraying whom.

Video Games

 * Happens in one of the Ace Attorney games (Trials and Tribulations), where Who was responsible for this nefarious deed? Why, it was

Web Comics

 * This happens in Sluggy Freelance when is revealed to be a Hereti Corp employee during "Dangerous Days."

Western Animation

 * The Simpsons: Mr. Burns orders Smithers to take a hit out on Homer Simpson after Homer sends him a nasty letter, disappointed with the gift he received for giving his son's blood to save Burns' life. Smithers calls the hit off. When Burns finds out, he literally calls Smithers "Judas!"
 * Teen Titans had an arc called "The Judas Contract" in which,  betrays the team to Slade. Toned down a bit for the animated series, but Beast Boy is still left saying "...why?"
 * This doesn't really fit. In both, Terra was The Mole. Her motivations were just different. She never had good intentions in her betrayal.
 * The first appearance of Red X also fits this trope, at least in the cartoon.
 * The Captain from Gargoyles could be considered one of the "wrong with disastrous results" variants of this: He really wanted the gargoyles to be accepted and appreciated by the humans rather than just taken for granted in times of war and despised in times of peace. End result of his plan: Most of the gargoyles were slaughtered, and the survivors (both human and gargoyle) rightly hated him for his betrayal.