This is the attitude that the protagonists of Weiß Kreuz take toward their work as assassins. They kill criminals who are above the law in order to help protect the innocence of normal people, while acknowledging that they themselves are also criminals and murderers, and expecting to be punished for it someday. Even their voice actors, one of whom is the creator of the series, do not expect their characters to meet good ends.
Sailor Moon: Sailors Uranus and Neptune consider their actions necessary but not worthy of forgiveness. They are revealed to have pure hearts midway through.
In Gundam Wing, Treize Kushrenada and Milliardo Peacecraft start a war to show humanity just how senseless war really is. Treize actually goes so far as to commit to memory the names of every single one of his deceased pawns, to show that he doesn't take their sacrifices lightly.
Another example is the side of Gundam 00's Celestial Being represented by the Ptolemaios crew. They are fully aware of the hypocritical and outright contradictory nature of their mission statement to end war through war, with some even admitting that they make for excellent terrorists. However, it turns out that the Ptolemaois crew is played for exactly the same reason; they themselves are rendered a hypocritical foe by the very same organization for whom they supposedly work. It works out, somehow.
Lelouch, The Protagonist, openly admits that he's doing reprehensible things in pursuit of noble goals (bringing down The Empire and making the world a better place for his Morality Pet sister). This is pointed out in an early second season episode where he engages in a short Breaking Speech to Honor Before Reason Guilford about the best way to confront an overwhelming evil. In the end he has himself killed to create world peace; whilst he never explains (to the viewer) exactly why he did it, the implication is that it was as redemption for the sins he committed during the course of the series.
Itachi murdered his entire clan save for his brother Sasuke and lived out the rest of his life as a traitor hated by everyone in order to prevent a war. He planned to die by Sasuke's hand since the beginning.
Danzo considers himself this, claiming the ninja world must unite, and there's no time to do it morally.Makes sense considering he is Itachi's old boss.
He may also be a mild deconstruction; some of his actions such as helping Hanzo out with Akatsuki as well as his approach to matters led to making problems much worse, most notably leading Kabuto to his Start of Darkness.
Dr. Kabapu from the Excel♥Saga manga claims to be this by seeking to destroy all Overtechnology left behind by the Solarian civilization in order to avoid the End of the World as We Know It repeating itself. However, it conveniently puts him in a position of power in Fukuoka City and sets him against his age-old nemesis Lord Il Palazzo, so it's less than clear whether his words, or Il Palazzo's for that matter, can be trusted.
The Iscariot Organization in Hellsing. Their Badass Creed is them chanting how they will follow the disciple Judas in following God's plan through the means of sin and betrayal, and that they will march into hell to do battle with its demons when they die.
Amber in Darker than Black is leading a sort of La Résistance against The Syndicate, having learned that they're planning to kill off every single Contractor by destroying the Gate. Unfortunately, the only permanent solution for that is to have BK-201 seal the area around the Gate, which would wipe Japan off the map. Being a Contractor, she has no qualms about it, but when presented with another option, is willing to Ret Goneherself to make it work.
Light Yagami starts off this way in Death Note because he is determined to sacrifice himself for the greater good. However, less than a week later he's squeeing over his promotion to godhood. It doesn't keep him from occasionally toying with the concept of himself as selfless and self-sacrificing, though. This doubles with What You Are in the Dark, as Light carries out his actions as quickly as possible during the first five days in an attempt to do as much good as possible before he meets his horrid end. It is only after finding out that there are no consequences for using the Death Note, that he begins to turn into the egotistical Jerk Ass that he becomes.
Captain Bravo of Busou Renkin descends into this when he accepts the order to kill Kazuki before he completely Victorizes (A process they did not know could be arrested or reversed at the time). He even freely admits that this is a war crime that he will have to answer for once the war is over.
Captain Bravo: I am going to terminate Kazuki and then defeat Victor. I will do my duty as Captain Bravo, the Warrior Chief. And then, as Mamoru Sakimori, I will pay for what I have done... by ending my own life.
Necessarius from To Aru Majutsu no Index is a English Anglican organization trained to hunt down magicians using that same magic. Their proper name is even "the Church of Necessary Evil."
Paul von Oberstein from Legend of the Galactic Heroes is a Necessarily Evilstrategist who seeks to overthrow the Deadly Decadent Court of The Empire (which he belongs to), at any cost. At one point, he allows two million people to die in an atomic attack he was forewarned about, simply because having it happen would discredit the nobles and help Reinhard take control of the empire. He is fully aware that he must be Reinhard's Poisonous Friend and in many ways plays the 'lightning rod', letting the negative public opinion focus on himself instead of Reinhard.
Okiura from Kobato is pretty clearly evil. He's with the yakuza, and using threats and underhanded tactics to force his own ex-wife Sayaka to shut down the preschool she's taught at all her life to collect on a debt she inherited from her father the former owner. That's Disney evil. It's later revealed that he's afraid that the yakuza will hurt Sayaka, and has been working from the inside to buy her as much time and safety as possible. He doesn't have the authority to call off the others, and he knows if she sells the building, she'll be safe. And better he shatter her dreams than the yakuza shatter her limbs. He does his best to appear cold and villainous in an attempt to push her into selling, and accepts that while he might be saving her life, Sayaka will probably never love him again.
Emiya Kiritsugu of Fate/Zero lives by this trope, although he is an extreme Anti-Hero rather than a villain. After his failure to kill one person his first crush, turning into a vampire destroyed the entire population of his home, he was willing to kill one person his father, continuing experiments that create vampires to ensure the destruction wouldn't spread. He lives by a harsh code of utilitarian ethics- killing the few to save the many. His ultimate goal is world peace, and he is willing to do anything to achieve it. As he himself says:
"Even if I am to carry "all the evils of this world", it won't matter. If that can save the world, then I'd gladly accept it."
He has a breakdown at the very end of the series when his attempt to destroy the Grail causes far more destruction and death, realizing that everything he did was pointless — not "necessarily" evil at all, just evil. He barely avoids falling into despair by rescuing and raising the lone survivor of the disaster: Shirou, the hero of Fate/stay night.
Mirai Nikki: This is how Yukiteru views himself, once he decides to actively take part in the Survival Game. Prior to that, the only people he killed were in direct self-defense. As he begins killing in order to win the game, he justifies it by saying that once he's become the new god, he can resurrect everyone he's killed and give them happy lives. Cruelly enough, he finds out far too late that even God can't bring back the souls of dead people. He doesn't take this news well.
In the back story of GUNNM Last Order, this attitude is essentially responsible for the state of the world. Arthur, the leader of humanity After the End establishes a totalitarian dictatorship with the goal of ensuring that the catastrophe that nearly left humanity extinct doesn't happen again, mobilizing all of Earth's remaining resources to achieve spaceflight and colonize the stars. He recognizes this as evil, and potentially the wrong decision, and leaves behind a means to end the undying dictatorship he created.
Attack on Titan thrives on people doing horrible deeds in the hopes of good outcomes. In particular, Bertolt Hoover readily admits their actions are impossible to forgive and recognizes how much suffering has been caused as a direct result. While genuinely remorseful, they refuse a Last-Second Chance because Someone Has to Do It.
Ozymandias in Watchmen constructs himself as Necessarily Evil in his final conversation with Dr. Manhattan, justifying murdering millions of people with his success in preventing further escalation of the Cold War and claiming 'he has made himself to feel every death'. He is never brought to justice for his acts and the comic does not judge either way, leaving the readers to make up their own minds on the subject. A throwaway comment that references the Black Freighter comic implies that, ultimately, he has availed nothing.
This is Jason Todd's original characterization and goal post-resurrection - he believes there is no way to stop crime legally, so he aims to control all the crime in Gotham instead and quell the worst the city has to offer on threat of death. Batman essentially counters that instead of saving Gotham by controlling crime, he's making things worse and driving the city into a gang war and, naturally, a fight ensued. Afterwards, Depending On The The Writer, he either kept this characterization or descended into more insane revenge schemes.
Alter from Y: The Last Man, after dealing with internal discord in Israel thanks to an abrupt end to their conflict with Palestine, concludes that America will suffer the same fate without an outside enemy to distract them — Naturally, that would be her. This is later revealed to be a cover for her real plan to be killed by Yorick.
Galactus, the Marvel Universeeater of worldsis needed for the survival of the universe... but only because if he dies, than something EVEN WORSE will take his place. And unlike Galactus, it won't just drain some planets of life after giving it's inhabitants a heads-up that they're world's about to be eaten, it would just destroy everything in the galaxy. His role as a necessary evil became a very big problem (well, bigger than usual) when he ended up being teleported into the Ultimate Universe. The Ultimate version of Galactus is a Hive Mind being that isn't required like mainstream Galactus is, but mainstream Galactus was so trained to his job of eating planets, that he refused to listen to reason and set about trying to eat Ultimate Earth and other inhabited planets... after taking control of the Ultimate Galactus and making himself even more powerful!
In the DCU, Amanda Waller's original characterization. One storyline had the Suicide Squad being forced into disbanding. Amanda's response: hijack three of the prisoners who made up the Squad, offer them their freedom in exchange for their cooperation, brutally massacre the gang of thugs who had set in motion the disbanding (and who were preparing to release a flood of zombifying drugs onto the streets)... and then turn herself in to face trial. Going further, she refused to use her knowledge of American espionage to get a better deal, reasoning that they'd dig her out if they ever needed her again. She ended up spending a year in prison.
The ending of V for Vendetta features this trope, though it's the protagonist who realizes that he can't live in the utopia he's spent the entire book trying to birth.
In Cable & Deadpool, Cable endeavours to unite the world against a devastating enemy - himself. The idea being, with his powers spiralling out of control and becoming a threat, everyone would team up and kill him, and then feel guilt for doing so, as his public plan was to establish an island utopia. Later in the same book, he aided the revival of Apocalypse so the decimated mutant race would have an enemy to unite against.
This is precisely why The Kingpin is still in business and also the reason why no one has made any serious attempts to get rid of him for good. If someone ever actually did kill him or ruin him so thoroughly that he had no hope of ever rebuilding his empire, the resulting power vacuum would lead to an innumerable amount of low-level crime lords fancying themselves the next Kingpin going to war with one another over his spot, and the carnage that would result would be far greater than Fisk could ever dream of causing himself. He knows this, Spider-Man and Daredevil know this... hell, just about everyone who could remove him from power knows this, and they sure as hell aren't about to disregard it.
Mephisto from the Marvel Universe often comes across as this. Hell is a necessary part of the universe. It inevitably corrupts any good person who tries to rule it. Any attempts at reform fail. And any hell lord besides Mephisto tends to be worse. So for better or worse whenever heroes will sometimes work with Mephisto to restore him to his throne since someone has to do the job as Lord of Evil and keep worse hell lords in check.
The main theme of The Dark Knight was Batman - and his perception in the eyes of Gotham City - becoming this. He hoped that Harvey Dent, Gotham's 'White Knight', would make him obsolete so no further evil of any sort would exist within Gotham.
Bane invokes the trope in The Dark Knight Rises, but could ultimately be a subversion. Despite his claim, he and Talia never had any intention of sparing Gotham, and even whether or not they agreed with Ra's al Ghul's assessment that destroying the city would make the world a better place is left ambiguous. Their true motivation was revenge on Batman. The League of Shadows as a whole certainly counts, though.
Mr. Glass in Unbreakable has spent his entire life being Necessarily Evil and looking for someone to counterbalance him so that his world will make sense.
The death squad in Magnum Force. They kill known criminals with summary executions because to them, courts do not work.
The Controllers and Director in The Cabin in the Woods. The Controllers have become desensitized enough to run bets and enjoy some of the "entertainment" the ritual provides, though a little bit of their basic human decency still slips through, and tell their new recruit that even his training isn't enough to prepare him for the real thing. The Director is extremely, painfully aware of how evil their actions are, and regrets them deeply, but will do everything possible to see them fulfilled.
The Red Queen is this in Resident Evil, going to any lengths to prevent a T-virus outbreak.
Literal example in Wreck-It Ralph; A video game only works when there's a 'bad guy' to defeat. When Ralph, the 'bad guy' of his game, isn't there, the game is declared out of order.
Vampire in Brooklyn: Eddie Murphy's vampiric antagonist kills and then impersonates an Evangelical preacher, then finds events contriving to force him into making an impromptu sermon. Given his own evil and selfish intentions, it's little surprise when he chooses the concept of Necessary Evil as his topic and sets about convincing his congregation not to be so hard on the bad guys as, without Evil for comparison, no one would know what Good was.
In Lord of War, Yuri labels himself as such at the end of the film because he's sometimes a middleman supplying weapons to conflicts on the White House's request that the politicians can't be seen to get involved in themselves. He's let go from custody and exits the movie a free man with gun running the only thing left in his life.
Emperor Ezar, in Lois McMaster Bujold's book Shards of Honor, sets up a massive interplanetary war and gets several thousand people killed, all to assassinate his son, a deranged sadist, and discredit his cronies, a batch of expansionist warmongers, thus averting the ascension of a madman to the throne and subsequent civil war.
The Wolves/Inhibitors of Alastair Reynolds' Revelation Space trilogy wipe out intelligent life any time they discover it spreading beyond its original planet. (Even they, a kind of Mechanical Lifeforms, are only intermittently sentient when necessary to reach their goals.) It eventually turns out they are trying to keep intelligence from being wiped out forever when our galaxy collides with the Andromeda galaxy several billion years in the future.
A small-scale version is the killer in The Victorian Hangman, the executioner for New York, unemployed after NY switched to the electric chair. He traveled west and continued his practice of eliminating criminals. After executing an adulterer, a thief, and a card cheat, he realized he was the only criminal left in the area.
In Gaunt's Ghosts: The Guns of Tanith one of the Ghosts' less savory members kills an old man to keep word of their secret mission getting to the Blood Pact. Subverted by the thoughts of Hlaine Larkin in the same squad thinking 'There was quite enough unnecessary evil in the fething galaxy without deliberately adding to it'.
The Horus Heresy novels provide us with one person who joined the Heresy not because he believed the Emperor had betrayed them, but because he knew it was side with Horus and save everyone except humanity, or side with the Emperor and screw over the entire galaxy and everyone in it: Alpharius. The Drop Site Massacre, and all other events of the Heresy, were being done in order to break the back of Chaos.
In Dark Angels: Angels of Darkness, Brother-Chaplain Boreas delivers a very short speech regarding the value of human life in the grim darkness of the 41st millenium.
"'Oh, I agree that battle and sacrifice result in death,' Boreas replied with a grimace. 'I understand that we live in a brutal universe, and that amongst the unnumbered souls of the Imperium, a few million deaths are immeasurably minute. The Dark Angels have purged worlds that are beyond all attempts at redemption, and we have done it with joy for we know what we do is for the security of the future. Truly it is said a moment of laxity spawns a lifetime of heresy.'"
Lord Vetinari legalized guilds for both the thieves and the assassins of Ankh-Morpork, formally organizing the city's criminals. The guilds own monopolies on those crimes: as long as they ensure that all thefts and murders are committed by licensed members and adhere to certain standards (like avoiding bystander fatalities and robbing any one citizen only once a year), they are permitted an annual crime quota and enforcement authority. Why does Vetinari expect criminals to abide by this agreement? Half self preservation, half simply knowing where they live since they do openly do business. In later books, the Thieves are mostly in the insurance business (offering a pre-emptive payment option in lieu of annual robbery) and the Assassins are more a snobby boarding school and gentlemen's club than a bunch of cutthroats. But they will still act with extreme prejudice to defend their lucrative monopolies.
Prof. John HicksHix — of the Department of Necroman- sorry, Post-Mortem Communications — serves a Necessarily Evil function for Unseen University. UU has to have an official evil (but not too evil) necromancer on the staff in order to extend their monopoly on magic to include necromancy and other black magic... and with it the authority to fireball all freelancers. The post of Official Post-Mortem Communicator carries a lot of authority and respect on the University Council, as Hix is also tasked with determining when it is appropriate to use small amounts of black magic in the service of the greater good.
This is an Alternative Character Interpretation of Judas Iscariot in The Gospel of Judas, a Gnostic text dating back to the fourth century. In it, Judas is depicted as following Jesus's instructions when he turned him over to Pontius Pilate, in order to set in motion the events that lead up to Jesus's resurrection (though only according to the National Geographic translation, not to serious scholars).
Harry Potter: Snape carried this role in the latter half of the series as Dumbledore's mole in Voldemort's inner circle. He had to do Death Eater things such as kill Dumbledore himself to prove himself and maintain his cover. Dumbledore planned for that to happen because he believed it necessary.
Dumbledore: Severus... please!
An inspirational tale that did the rounds about two captives who were being tortured into renouncing their faith. One night, the first man admits that if the tortures continue the next day, he will have no choice but to surrender. His friend spends the night mulling over whether to kill the first man so that the first man's immortal soul might remain saved - while he himself will be damned to hell for the murder - but at last realizes that it would be wrong. His choice was right, because the first man mercifully dies on his own in the morning before the torturers come.
In Daniel Suarez' Daemon Sobol's plans for a new society require him to tear down the one that currently exists, ultimately causing global economic and social chaos. In the end, it appears that his actions are justified.
Varys in A Song of Ice and Fire claims himself to be this: "Why is it always the innocents who suffer most, when you High Lords play your Game of Thrones?" However, he is perhaps the most gifted intriguer and spy in the Seven Kingdoms, so his own motivations are incredibly clouded.
Ebenezar McCoy of the Dresden Files taught Harry about how magic is suppose to be about protecting life and respect for the laws of magic. Ebenezar is the Blackstaff, the only wizard on the White Council who has permission to break the seven Laws of magic, ranging from mind control to mass murder, when the "rules" are being used against the council and to prevent even worse disasters.
And it later turns out that the purpose of the Winter Court of the Fae is to protect our universe from the Outsiders, and the Summer Court protects mortals from Winter.
In The Stormlight Archive King Taravangian sees himself this way. When called on it by his Dragon Szeth, he fully admits that he's a monster, but that he's "the monster who will save this world".
Forever Gate: Leader of the Users attempts to convince Hoodwink the gols are this trope. In a nushell this is his argument: The gols do nasty things but without them our civilization would crumble.
Live Action TV
This is how Chief of Police Unser views his arrangement with the eponymous bike gang of Sons of Anarchy. He allows them a more or less free hand in and around Charming and they keep drugs and other gangs out.
Tigh: Which side are we on? We're on the side of the demons, Chief. We're evil men in the gardens of paradise, sent by the forces of death to spread devastation and destruction wherever we go.
UFO. Although the nature of the aliens is a mystery, their harvesting of human organs indicates they come from a Dying Race. Commander Straker suggests they view humanity not with malice but with callousness ("much as we view our food animals"). Straker later encounters a man with telepathic powers who is being controlled by the aliens. In the middle of their conversation he suddenly blurts out: "We mean no harm to the peoples of Earth. Why do you attack us? We're fighting for existence... you must understand!"
Torchwood's Captain Jack Harkness, when he's not The Ace, a Lovable Rogue, or a Chivalrous Pervert, pretty much bases his entire character around being this. The best (worst?) examples are the episodes "Small Worlds" and "End of Days", and of course, the miniseries Children of Earth.
The Shadows regard themselves as agents of evolution and the genocidal wars they wage on the galaxy as an effective form of natural selection and development drive for the Younger Races. The problem is that there never was a need for such accelerated development, and Shadows only enforce it to prove that it works.
William Edgars, who plans to use an artificial plague to institute a Final Solution on human telepaths, finds it to be a monstrous idea but the most expedient solution to what he considers an otherwise unsolvable problem.
Queen Mab from the Merlin-1998 series tries to pass herself off as this, but the other characters don't believe her, mostly due to her complete and utter amorality in the face of the pain caused by her actions. As emphasized in the novelizations, Merlin is also "necessarily magical" as he uses the magic of the Old Ways to create a society free of the Old Ways, and gradually becomes less and less welcome in the new society when the now predominantly Christian kingdom gets less tolerant of a wizard of the Old Ways.
Buffy the Vampire Slayer included lamp-shading the overlap between this and Shoot the Dog in the season 5 finale when Giles explains why he is about to kill Ben (Glory's relatively innocent human host), because Buffy won't and shouldn't have to.
In season 6 of Supernatural, Castiel becomes this after Micheal has been locked up with Lucifer, and the only remaining archangel wants to break open the cage so Lucy and Mike can finish up their big fight, or even worse, become the new God. Faced with the prospect of death, or going along with these plans, Castiel was forced to Take a Third Option that had him trying to handle the slippery slope without jumping.
Allison Taylor does this in the final season of 24 by protecting the true masterminds behind the terrorist attacks earlier in the day and allowing them to go unpunished for the actions even after learning they were behind it all in a desperate attempt to secure a peace treaty between the United States, Russia, and another country.
Gul Dukat believes his actions during the Cardassian occupation were this, and forms a major guilt complex over it.
Winn Adami believes many of her more extreme actions are this, when they're not completely justified and necessary.
Section 31 (which may or may not exist) are this to the Federation. They do all the horrific, underhanded things Federation ideals forbid but are necessary to its survival. If it exists, it may have been deliberately set up by the Federation at its founding to be this. Or it may not. The details are a little vague.
Given that they served on the most important location on the frontlines of the most brutal and destructive war in Alpha Quadrant history, pretty much the entire senior Command crew of DS9 had a moment or two of this. But none more than Sisko, who in "In the Pale Moonlight" takes decidedly non-Starfleet-like actions in secret that bring the Romulans into the war on the side of the Federation.
"But the most damning thing of all... I think I can live with it. And if I had to do it all over again, I would. Garak was right about one thing, a guilty conscience is a small price to pay for the safety of the Alpha Quadrant. So I will learn to live with it. Because I can live with it. I can live with it..."
This is how General Evil initially viewed himself, explaining why George Ogel agreed to be called "General Evil" while serving under his brother. Despite genuinely believing that his beliefs were correct and ultimately for the greater good, he was aware that his morals would be considered "evil" by the general populace. These beliefs faded away after the incident which left his body scarred, after which it became personal.
Dr. Rex most likely knew that dooming his own species to extinction would be an act considered "evil", but in his delusions created by the Darkitect's manipulations, he believed that this was for the greater good of the universe.
The Imperial Inquisition. On a whim, every fully ranked Inquisitor in the service can have any individual pressed into service, commandeer vehicles (up to and including Space Marine Battle Barges) for their use, summarily execute anyone they deem heretical, torture people indefinitely, and call down Exterminatus: the complete destruction of the biosphere of a planet, if not just blowing up the whole damn rock. Their decisions are inviolate. One of the most famous phrases ever uttered by an Inquisitor is "A plea of innocence is guilty of wasting my time. Guilty." Why is this gross extremism necessary? Because if they weren't around, the taint of Chaos would spread unchecked throughout the Imperium, and within less than a dozen generations the whole galaxy would be rendered lifeless and/or sucked into a psychic-energy-powered expy of HELL itself. So, yes, horribly evil, very necessary.
The perfect example would be Inquisitor Kryptman. He ordered the creation of a Galactic Cordon, and in the process caused hundreds of billions of deaths and more destruction than any set of events since the Horus Heresy - including the Reign of Blood, the Black Crusades, and the Armageddon Wars. He saved the galaxy, but was declared Excommunicate Traitoris for his methods. (What is a Galactic Cordon, you ask? He ordered Exterminatus on every inhabited planet in the path of Hive Fleet Leviathan so that it wouldn't be able to replenish itself on the biomatter of those worlds.)
This trope is the title of a Savage Worlds book that allows PCs to play supervillains in world where aliens had successfully killed off all the superheroes.
In Exalted the Sidereals deliberately ended a golden age, caused the deaths of millions of innocents, plunged Creation into medieval squalor, threatened and murdered some of the gods themselves to go along with the new order, and spent the next millennium tracking down and murdering the innocent reincarnations of the world's greatest heroes. It was the only surefire way to save Creation from being utterly destroyed.
In Jesus Christ Superstar Judas considers his betrayal of Jesus to be this in order to keep his movement from getting out of hand and destroying the Jewish people. To a lesser extent this is also true of Caiaphas although there's also a large amount of self interest mixed in in his case.
The big twist at the end of Urinetown is that the Evil Overlord Cladwell was right the whole time and the revolution that overthrows him makes everything so much more awful than it was under his draconian rule.
Ulysses is played like this toward the end of Jon English's Paris. He was like this to an extent in the original Iliad, but it's made explicit that the wooden horse was a case of this in the musical.
Logan views his actions as these in order to fund an army and prepare Albion to deal with an Eldritch Abomination called the Crawler.
You have to be this to get the bad-karma ending, otherwise known as the one that doesn't involve everybody you know and love dying. Unless you feel like playing the Lute for ten hours or going into real estate. Have I mentioned you're the king/queen?
Kessler, the Big Bad of inFAMOUS, Kessler is The Protagonist Cole McGrath's future self. In the future he was the world's most powerful conduit, but when the world needed him most, he vanished, following which the world got blown to hell by the real villain. Feeling guilty for not stopping it, he uses his powers to travel back in time in order to accelerate the development of the Ray Sphere, which gave him his powers, and to shape his past self into the kind of person who would be capable of saving the world by killing the only woman he ever loved and destroying half the city.
The sequel reveals that this backfired since the villainalso got his powers from the Ray Sphere. Woops. If only Kessler knew the Ray Sphere was the device that lead to the villain's creation...
Ammon Jerro in Neverwinter Nights 2. Not only does he deal with devils, and other deadly creatures of the lower planes in order to get what he needs done. True, he's trying to save all of the sword coast. But at the same time he kills his granddaughter, and several other people whom are really not all that bad. They just happen to get in his way. Though he does have a Villainous Breakdown when he realizes who Shandra was, and spends the rest of the game trying to atone for what he's done.
For the most part the Overlords are this to the world. They seem to save the world (so they can take it over) from the other (worse) evils and Fallen Heroes. Rose states that the Balance Of Good And Evil will mean that during the times when Light Is Not Good and becomes too powerful, Darkness is required to triumph.
According to the manual, Gill. Like all Street Fighter canon, it's... complicated.
Bian Zoldark and Maier Branstein in Super Robot Wars Original Generation. When they realized that the government was preparing to surrender to the coming alien invaders, they launched an attempt to Take Over the World, in order to give mankind the means to fight back against the invaders, remove those who wanted to collaborate, and finally, ensure that the heroes were strong enough to spearhead the counterattack. Tragically, a lot of their minions had different plans. Most of which involve 'kill the heroes, take their place'. Which may have been Bian and Maier's back-up plan.
Seraph Lamington in Disgaea allowed Vulcanus to run amok, and later justly but "excessively" punished Flonne for a relatively minor sin by turning her into a flower. He was however willing to, and counting on, being defeated by the protagonist. It is revealed in the good ending that he was plotting with the ghost of the Netherworld's ruler to use a Batman Gambit and force Laharl to grow up and become kinder, so they will unite both kingdoms. In the good ending, Laharl spares the Seraph's life, and he returns Flonne to life as a fallen angel (with cute bat wings and red trim), which was part of his plan all along assuming Laharl passed the Secret Test of Character - Not that that matters anymore, now that she's his right hand angel now.
Valvatorez, the protagonist of Disgaea 4, is a strange sort of Punch Clock Villain who sees his job of being an evil, human-terrorizing tyrant as a very important public service - If he isn't going to Scare 'Em Straight, who will?
Wild ARMs 2 has Irving Vold Valeria, who formed both the heroes and the villains as a two-tiered plan to gather information as well as global resources in order to stop a sentientdimension from swallowing their world. The villains could use whatever tactics they wanted; and the heroes would be able to get the combined support of the world's governments who wanted them to stop the villains.
In Suikoden II, Jowy seems at first to be simply a Face-Heel Turn or a Rival Turned Evil, when he betrays the city of Muse to the Highlands, assassinates the Mayor, and opens the gates to the invaders. It turns out, however, that he only did it because he knew that the only way to stop the monstrous Luca Blight, was from the inside - and so, he sold out Muse in order to gain Luca's trust, so that he could later betray him, bringing about his death at the hands of the hero. However, by the time Luca dies, Jowy has already married Luca's sister, and he thus becomes the ruler of Highland... and thus, he is responsible for the nation, and feels compelled to win the war. At the very end of the game, he is gambling on The Hero killing him, so that he can use his life-force to seal the Beast Rune that Luca unleashed earlier... whether it actually ends that way, however, depends on a few things...
In Pokémon Ruby and Sapphire, you are required to ally yourself with either Team Aqua or Team Magma (depending on which game you are playing) in order to oppose the other Team. This does not mean that the Team you are allied with isn't evil, however; they are simply not currently involved in any world-threatening plans, while the Team you are opposing is clearly doing something worse.
Claudia Wolfe from Silent Hill 3. She acts cruel and evil to the protagonist and orders the murder of her father...but Heather eventually finds her diary, which is filled with entries about how much she's sorry for having to put Heather through all this, and only feels she must do it to bring the birth of paradise for Heather and everyone... everyone, that is, except Claudia herself. She believes in Hell, by the way. That's right, Claudia believes that she deserves to go to Hell for committing the necessary evil to save everyone else, meaning she absolutely embodies this Trope. Heather stops whatever the result would have been, but Claudia's intentions are definitely well intentioned and self aware.
One possible interpretation in Knights of the Old Republic is that Revan waged war against the Republic in order to toughen them up and force them to become more militaristic to prepare them for future conflict that Revan alone foresaw. The second game of the series has the other theory that it was to prevent societal collapse, or that it was all part of a plan to prepare for ANOTHER enemy. Which he left to find. This is supported by Kreia's question about Revan's "fall" in KOTOR 2: "Did Revan truly fall? Or did he do whatwas necessary to prepare the republic?" It is implied through the game's plot that the enemy Revan "prepared" the galaxy for were the True Sith, featured as the main baddies in the upcoming Old Republic MMO.
If you're going to bring the Star Wars Expanded Universe into this, the original Heir to the Empire trilogy portrayed Grand Admiral Thrawn as a ruthless warlord but a competent, at times even caring commander. The later books set him up as someone attempting to prepare the galaxy for invasion, which came with the Yuuzhan Vong.
Trias the Betrayer from Planescape: Torment is a Fallen Angel who betrayed his kin and made a compact with the lower planes. He actively works towards shifting the balance of the planes towards evil in return for the command over an army of devils should he succeed. Trias plans to use this army to attack the gates of heaven themselves. While he's expecting both this army and himself to be defeated, his hope is that such an act would be enough to rouse the celestials of the upper planes to take a more hands-on approach in the war against evil instead of doing what he saw as being Achilles in His Tent while evil was allowed to run rampant.
Sephiran from Fire Emblem: Radiant Dawn. Acts affable to the end, and loyal to one of the heroes even while he is fighting the others. Can't be talked out of fighting the heroes, yet is happy upon defeat.
The following pattern is pretty common in Fire Emblem, especially in the endgame of Radiant Dawn:
"I can't allow you pass" [grueling battle] "Thank you for killing me, please move onward!"
Wallachia in Melty Blood. Turns out he was trying to prevent the end of the world, but every solution he came up with just made things worse. He became a Dead Apostle in order to get the power to hopefully avert it.
Speaking of the Nasuverse, we have Emiya Kiritsugu, from Fate/Zero and Fate/stay night, who is more than willing to shoulder all the evils in the world in order to save everyone. He did shoulder all the evils in the world, but didn't completely save people from them.
Yuan in Tales of Symphonia may be this or a Well-Intentioned Extremist. It doesn't show him acting guilty for what he does, but then again, he doesn't show much emotion at all and the storyline doesn't focus on him enough to give him a chance.
Being a fairly nuanced RPG, Dragon Age: Origins allows you to behave like this in any number of situations, justifying a great deal of evil as necessary to destroy the darkspawn.
In the sequel, Anders stands out among a city of Well-Intentioned Extremists as one of the few who acknowledges that the actions taken to reach his goals are inexcusable. He doesn't blow up the Chantry because he thinks it's the right thing to do... but because things have gotten so hopeless and the stalemate between the templars and the mages has remained deadlocked for so long that he sees no other option.
Meredith verges on this a few times as well, though it swings back and forth between this and Knight Templar given the Sanity Slippage means one moment she's insisting the templars are entirely in the right, and the next she seems more regretful and willing to acknowledge some of her methods for controlling the mages are inhumane. Sometimes within the span of a few seconds.
The Mages' Circle is guilty of this as well; they actually are harboring Blood Mages and Abominations, firstly because the evidence of their existence would be all the Templars need to oppress them further or outright purge them, and secondly because if the Templars decide to do that anyway the Circle will need all the power they can get on their side. Their necessary evil comes to the same logical conclusion at the same time as the Templars'.
Duke of Tales of Vesperia is the poster boy for this trope. His Entelexeia friend Elucifur was betrayed and killed by humans right after Elucifur helped them win the Great War. When the Adephagos eventually showed up, his solution for it was to destroy it using the energy absorbed from the life force of humans, including himself, effectively wiping humanity off the face of the planet but saving every other life form. Unusually for the final boss, the party manages to talk him out of it at the end of battle and he ends up helping them.
Master Mattias in Luminous Arc 2, who seems to continue his reign of terror of killing people to fuel Rega the demon sword with their souls, after being released from being sealed by Fatima and Josie. He's actually preparing to stop the Beast Fiends at their source and sealed them away, plus the souls inside Rega will be released after it's used for the plan.
In Rockman & Forte: Challenger from the Future, R-Shadow reveals to Mega Man that the reason he's come from the future to destroy him was to stop the problems that Wily has caused at its roots by destroying all of the robots of the past.
In Jade Empire, Sagacious Zu claims that he viewed the actions of the Lotus Assassins — killing political opponents and terrorizing the citizens of the Empire — as necessary to preserve the authority of the Emperor and the stability of the Empire. When they started targeting women and children purely as punitive action against their husbands/fathers, however, it got too much for him.
In order to save the world, The Joy had to be perceived as a traitor and die by Naked Snake's hands. Needless to say, this caused some nasty emotional trauma to him.
Act 3 of the FreeSpace 2modWar in Heaven has the Fedayeen faction. They view themselves as monsters and psychopaths who have no place in their relatively peaceful society, and are expected to carry out atrocities without hesitation, while still recognizing that they are atrocities. They use any means at their disposal to secure the survival of the United Earth Federation, because their defeat will (supposedly) signal the extinction of the human race, and maintain there's no room for morality when the stakes are that high. Judging from what we've seen in the story so far, they may have a point.
Many of the Renegade decisions in the Mass Effect games can come across like this.
Saren Arterius, The Dragon of Mass Effect 1, believes his terrible actions such as attacking a defenseless colony, researching living weapons, and betraying the Council are absolutely necessary for the future of the galaxy. Tela Vesir, a Spectre in Mass Effect 2, provides this justification for her ruthless actions such as ( bombing an office building with many civilians inside). She combines this with Not So Different and Shut Up, Kirk! if a Paragon Shepard - who is working with the terrorists of Cerberus - calls her out on it.
In Mass Effect 3, Paragon Shepard appears to view working with Cerberus in Mass Effect 2 as a necessary evil: (s)he hates what they stand for and what they do, but they were literally the only people in the galaxy who were actually listening about the Reaper threat and taking it seriously. During the events of Mass Effect 2, (s)he had nowhere else to turn when things needed to get done.
The titular Kamui fighters are considered this since they use the inhumane Brain Uploading technology, but they where necessary due to the ZODIAC's laying waste to the earth at the time.
Balthazar in Baldur's Gate 2: Throne of Bhaal. He is one of the Five, a group of Bhaalspawn convinced by the Big Bad to exterminate their siblings, ostensibly in exchange for a chance to serve as the lieutenants of Bhaal, the dead god of murder, when he is resurrected by the deaths of enough of his children. When you confront him it turns out he has other plans - he intends to eliminate the other members of the Five and as many Bhaalspawn he can find, the Big Bad (who is the only one who can resurrect Bhaal), and then kill himself, ensuring that Bhaal's chance to return dies with him. The player has no choice but to fight him, and he verbally regrets the player character death as a "necessity."
The plot of Shadow Hearts: Covenant does retcon the first game's antagonist Albert Simon's plans, turning him from a Well-Intentioned Extremist into something more like this trope. It turns out Simon was desperately trying to stop Rasputin - yes, that Rasputin - and the secret society Sapientes Gladio from potentially destroying humanity in their mission to take over Europe through occult means.
The Big Bad of Shadowrun Returns: Dragonfall is willing to loose an insane dragon upon Berlin, infected with a magical virus that will spread across the globe and cause a worldwide draconic genocide because of the threat they cause. He seems to deeply regret his own actions but claims they are necessary to save metahumanity from inevitable subjugation by dragonkind.
Also in the same comic, Klaus Wulfenbach took over Europe and rules it with an iron fist to prevent Sparks from running wild and terrorizing the populace with pointless wars. There are those who believe him to be a "mere" Well-Intentioned Extremist.
Best example: Procedure 110-Montauk, which is never described in detail, but the details we are told aboutnote Like the fact that all non-D-class staff have to be rotated out every two months for psychological counseling, and are permitted to subject themselves to Laser-Guided Amnesia after they've completed their assignment with SCP-231 make it clear that what they are doing is subjecting an innocent young woman to a horrifically traumatizing procedure which they must modify to be even worse if she ever becomes desensitized to it, because if they don't, she gives birth to something undisclosed which poses a serious threat to everyone in the surrounding area and possibly life as we know it. An Easter Egg hidden on the page questions how necessary this evil actually is.
She-Beast of the Whateley Universe describes the international supervillain Dr. Diabolik like this, including talking about the thousands of people who have died in his efforts to advance the human race. She may be giving him more credit than he deserves though, since she is his daughter.
Now that we have seen him attack the entire city of Cincinnati, we know the truth. She didn't give him enough credit.
Amanda Waller saw Cadmus as a check as against the Justice League falling from grace.
The Justice Lords. They see themselves as being able to accomplish what the Justice League cannot.
Wonder Man in The Avengers: Earth's Mightiest Heroes; the only reason he is acting as a member of the Masters of Evil is because their Black Magician Girl, the Enchantress, is the one casting the spell that allows him to stay alive, meaning he can only stay alive if he does what they say. Other than that, he has absolutely no interest in being a supervillain.
Kang the Conqueror in Avengers: Earth's Mightiest Heroes seems to be an example of this.