Itachi Uchiha from Naruto is undoubtedly a villain who killed his entire clan, and later it is known that he did so because he received orders from the leaders of Konoha to prevent the coup d'état and a war. He did all this to protect Sasuke, his brother who has the sharingan.
Curiously, later on, karma is responsible for causing his own brother to defeat him in a battle, becoming mortally ill, and then finding out about the sacrifice his brother made for his people.
A really nice story.
I invite @albiro2050 to join this contest.