Warning: The following contains SPOILERS for the Supergirl season 5 finale.

Lex Luthor was the true hero of Supergirl season 5. It has been said that Lex Luthor's great tragedy is that he could be Earth's greatest hero if he were not obsessed with proving himself superior to Superman. Certainly the Arrowverse's Lex Luthor sees himself as a hero (he asserted as much when The Monitor resurrected him) proving the adage that nobody sees themselves as a villain, and everyone is the hero of their own story. Yet a case could be made that, in Supergirl season 5, Lex  truly was the most heroic character from a classical standpoint.

In classical literature, a hero is defined by a fatal flaw which they must overcome as part of their journey. In Lex's case, he has perhaps the most famous classic hero flaw of all; hubris, with his excessive pride causing him to overestimate himself or underestimate his adversaries. Usually in the comics, Lex Luthor's losses come about because of his inability to resist adding insult to injury once he thinks victory is certain, or because of his failure to avoid indulging his petty grudges.

Related: Supergirl Season 5 Ending: Is [SPOILER] Dead?

The Lex Luthor seen in the second half of Supergirl season 5 was a changed man in many respects. Waking up in a world where he was once again a respected businessman and owner of the DEO rather than a publicly known war criminal and the self-proclaimed greatest criminal mind of his generation, Lex's first action was to try and make amends to his sister, Lena; one of the few people whose feelings Luthor truly seemed to care about and the person who ultimately outsmarted him and killed him at the end of Supergirl season 4. After learning of the threat posed by the alien group called Leviathan, Luthor offered an olive branch to Supergirl and DEO Director Alex Danvers, proposing a truce so that they could work together to deal with the larger threat posed by Leviathan.

Supergirl Season 5 Finale Lex Luthor With Leviathan Leaders

With the exception of Brainiac-5, every member of the Super Friends refused to even think about working with Luthor, and Alex Danvers quit her job with the DEO rather than work for him. While the Super Friends became obsessed with thwarting everything Lex Luthor was trying to accomplish, Luthor remained focused on stopping the aliens planning to destroy humanity. While it was Brainaic-5 who defeated Leviathan by trapping the immortal aliens inside a bottle as his ancestors used to trap planets, it was ultimately Lex Luthor who masterminded that by arranging events so that Brainiac-5 would be compelled to take that action.

Lex also risked his life playing a dangerous game, endearing himself to the Leviathan leader Gamemnae while knowing that one false move could get him killed. Granting that Lex also manipulated events hoping that Leviathan and Supergirl would destroy each other, it can't be denied that he overcame his hubris and at least tried to work with his greatest enemies in the name of a higher purpose, before trying to kill two birds with one stone. While he may ultimately fall prey to his baser instincts in season 6 of Supergirl, for now it can't be denied that Lex Luthor, for all his manipulative ways, was the hero Earth needed when it counted most.

More: What To Expect From Supergirl Season 6