Warning: SPOILERS for Supergirl's season 5 finale.

Supergirl's season 5 finale ended on a major cliffhanger with the question of whether or not Brainiac-5 is really dead open for interpretation. The former Legion of Superheroes member and current science expert of the Super Friends struck the final blow in the battle with Leviathan but paid a heavy price that left him on death's door.

The central conflict of Supergirl season 5 has seen Supergirl and her allies working to unravel the machinations of Leviathan; an ancient organization run by a mysterious group of aliens, who have been manipulating humanity since the dawn of time. Following Crisis on Infinite Earths, Lex Luthor also learned of the existence of Leviathan and offered a truce to the Super Friends so that they could deal with a common enemy that threatened humanity together. All of them rejected the idea of working with Luthor except for Brainiac-5, who agreed to the team-up purely because a version of himself from an alternate universe said that his friends would all die unless they worked with Luthor. This drove a wedge between Brainy and the rest of the Super Friends, as Alex Danvers resigned her position as DEO Director rather than work under Luthor and Brainy was promoted in her place. It also ended his romance with fellow superhero Nia Nul, aka Dreamer.

Related: Supergirl Season 5 Sets Up Alex Danvers As Arrowverse's Latest Vigilante

The Supergirl season 5 finale, "Immortal Kombat," saw Brainiac-5 working alone while his friends coped with the problem of Leviathan striking out against Supergirl, armed with Kryptonite that had been provided by Lex Luthor, all as part of his efforts to endear himself to Leviathan so that he could bring them down from within. Luthor's plan was to alter a computer program devised by a doppelganger of Toyman that would transform someone into an immortal artificial intelligence, reverse-engineering that code to make the all-powerful aliens running Leviathan mortal and vulnerable. There was one unfortunate snag Luthor did not foresee; Leviathan protected their base with a radioactive force-field that would slowly poison anyone who wasn't wearing a special protective pin. This would ultimately result in Brainiac-5's death, if he can't escape the base on his own.

Supergirl season 5 finale Lex Luthor steals bottle from dying Braniac-5

When Luthor refused to move against Leviathan until after they were done destroying Supergirl and the rest of her friends, Brainiac-5 went into action behind Luthor's back. He snuck into Leviathan's base on his own and braved the radioactive force-field to enact his own plan. Rather than kill Leviathan outright, Brainiac-5 intended to trap the god-like aliens in a bottle, using the same technology his ancestors had once used to store whole planets for safe-keeping. Unfortunately, Luthor had predicted that Brainiac-5's inherent nobility would win out over his sense of logic, and he was ready to swoop in and steal the bottle containing Leviathan for his own purposes, leaving Brainy for dead on the floor of their base.

While this cliffhanger did end Supergirl season 5 on a thrilling note, it seems highly unlikely that this is the end of Braniac-5. One major subplot of the season has centered around Dreamer's recurring dreams of Brainiac 5 smiling at her with a crazed look in his eyes. She misinterpreted these dreams as being part of her inability to get over her relationship with Brainy, until the Supergirl season 5 finale where she realized the dreams were trying to warn her about what he was going to do and that he was in danger. It would be wasteful and pointless from a writing standpoint to set up this revelation if Dreamer were not meant to ultimately save Brainiac-5 because of it. Additionally, with Jesse Rath's name on the cast list for Supergirl season 6, it seems likely he's returning for more than just a death scene.

More: What To Expect From Supergirl Season 6