Wrong Side All Along

Normally, the villain or rival is trying to stop the hero For the Evulz or perhaps just out of selfishness. However, sometimes things are not what they seem. The mentor the party has come to trust throughout the story has been using them, or perhaps corrupting them, and the apparent Big Bad was actually trying to save the world, and redeem them. Expect a Heroic BSOD or three.

Normally, this can go several ways. The character can either undergo a Face Heel Turn or Heel Face Turn, they can become completely depressed and take their life, or they can refuse to believe the realization and continue helping their mentor as before. Alternatively, this may end up being subverted, and the villain is just trying to trick them by painting their favorite hero as a villain.

Obviously, this will contain spoilers.

Anime and Manga

 * Blue Dragon,
 * Kamikaze Kaitou Jeanne,
 * In Darker Than Black,

Comics

 * In the first volume of The League of Extraordinary Gentlemen, the League works for "M", speculated to be Mycroft Holmes. However, as it turns out,

Film

 * Indiana Jones and the Last Crusade.
 * In Sky High, the cute new girl is playing him for a fool, and the imposing bully guy is actually just hot-headed.

Literature

 * Memory, Sorrow, and Thorn: The heroes are striving desperately to save the mortal races from the undying wrath of the Storm King, and are using the fragments of a book of prophecy to help them.

Live Action TV

 * In the first episode of Alias, Sidney Bristow is happily working for the CIA and her boss/mentor Arvin Sloane. Then she finds out that she's not working for the CIA, she's working for a terrorist group against the CIA, and Sloane is in on it.

Video Games

 * In Castlevania: Order of Ecclesia, Shanoa is instructed by her master Barlowe to cast the Dominus glyphs to permanently destroy Dracula. His other disciple Albus interrupts the ceremony and steals the glyphs, leaving her without memory. The game goes into a long trek to track him down and get the glyphs back.
 * In Jade Empire,