In the Hero of Ages, book three of the Mistborn Trilogy by Brandon Sanderson, the protagonists must fight the god of chaos and destruction, Ruin, to keep their world, Scadrial, from being completely annihilated. Ruin’s counterpart, Preservation, is the god of stability and perpetuity.
Ruin was not always the antagonist of the series though. In the first two books, Mistborn and the Well of Ascension, the heroes fight to overthrow the Lord Ruler, an oppressive leader who, centuries ago, took the power at the Well of Ascension. This action gave him godlike abilities, and ensured that Ruin would stay locked away until the power returned to the Well, as Ruin was trapped there, and could only be released if the power was as well.
The Lord Ruler created many new species with his abilities when he first gained them. One of these species was the kandra, who bound themselves by contracts, and took pride in never breaking those contracts.
“What do you think we are?” TenSoon asked. “Humans, with their rebellions and upheavals? We are kandra. We are of Preservation. We follow order.” (p. 178).
Throughout the entire first two books, the Lord Ruler is thought to be a being of pure evil. He was an oppressive dictator who mercilessly slaughtered millions. After the primary protagonist, Vin, slays the Lord Ruler, the power returns to the Well of Ascension, and she, unbeknownst to the fact that giving up the power will free Ruin, releases the power there.
In the fight to stop Ruin from destroying the world, the heroes discover more and more about the past, which the Lord Ruler had kept hidden from his people. They discover that the Lord Ruler worked, just as they are now working, to stop Ruin. He even created many species, such as the kandra, that were of Preservation, Ruin’s opposite. Though power inevitably corrupted him, and he was never the most noble of people, the Lord Ruler prepared for centuries for the day Ruin would return, and had he been left alive, he would’ve saved Scadrial a second time. I find it very interesting that by assassinating someone who they viewed to be a no-good oppressive leader, the heroes of the story also unleashed an even greater evil.
Usually in books antagonists are either complete evil, or working for a cause they believe to be good. The Lord Ruler was a mix of both of these types of villains. He did not want the world to be destroyed as Ruin did, and tried his hardest to stop the god of chaos. However, he was also at heart a selfish and cruel man, encouraging the rape and murder of millions of skaa, the lower class people, and killing off an entire race simply because he was afraid of anyone getting powerful enough to contest him.