WARNING: This article contains major spoilers for "Immortal Kombat," the Supergirl Season 5 finale.


Supergirl Season 5 ended on a dire note for Brainiac-5.

Over the course of the season, Brainy has worked alongside Lex as a double agent for the sole purpose of defeating Leviathan and saving Earth. When push came to shove, he decided to sacrifice himself to save his friends from Lex's wrath. Unfortunately, that played right into Lex's hand.

RELATED: Supergirl Debuts Alex Danvers' Super Suit

The finale picked up with Lex gaining entry to Leviathan's ship. He quickly learned Leviathan had put some safety measures into effect: namely, a barrier that kills any non-Leviathan entity that passes through it. Because he had won her favor, Gamemnae gave him a device that allowed him to enter unharmed.

Although Lex had the means to stop Leviathan then and there, he decided to hold back. He wanted to wait until Leviathan destroyed Supergirl and her friends before he stripped them of their immortality. Brainy wouldn't let that stand, so he devised another plan. Using his race's technology, he planned to shrink Leviathan and trap them before they could harm his friends.

RELATED: The CW's Supergirl Will Return Later Than Other Arrowverse Series

However, the barrier on the ship posed a problem. During a discussion with his doppelganger, he acknowledged his plan would kill him; he simply could not survive for very long on Leviathan's ship. Nevertheless, he soldiered on and successfully shrank -- and captured -- Leviathan inside a Coluan device.

When Lex found him, Brainy was close to death on the floor of the ship. That didn't stop him from gloating about Lex underestimating him, but Lex quickly set him straight. "I underestimate nothing," he shot back. "I knew you would decide to shrink the gods instead of kill them due to your precious moral code. I planned for that. I just didn't think that you would kill yourself. Well, Supergirl lives, but I have the ball. You gave me exactly what I needed. I'm just going to kill Supergirl myself. It'll be fun. And you can die alone, just like you intended."

With that, Lex seized the container and brought it back to his lab. He passed it off to his mother with a simple, "Let's get to work, Doc." With a smile, Lillian Luthor gazed down at the device in her hand and said, "Right away, dear." Their plans for Leviathan remain unclear at the time of writing.

RELATED: Supergirl's Brainy Would Wear His New Costume All The Time, If He Could

Elsewhere, Dreamer finally allowed herself to see what her dreams had been trying to show her all along. She finally understood Brainy's plan and saw a vision of him dying. "It's Brainy. He stopped Leviathan," she revealed. "He saved us. He needs my help." However, it is yet to be seen if the Super Friends will make it there in time to save him -- or if they will be able to reach him at all, given the barrier on Leviathan's ship.

Like the rest of the Arrowverse shows, Supergirl will return next year. However, the show will be held for a midseason debut to accommodate star Melissa Benoist's pregnancy. The CW's midseason is expected to launch sometime between April and June 2021, which means we may not find out about Brainy's true fate for about a year.

Returning to The CW in mid-2021, Supergirl stars Melissa Benoist as Kara Danvers, David Harewood as Martian Manhunter and Chyler Leigh as Alex Danvers.

KEEP READING: Supergirl Destroys An Iconic Part Of The Show's Mythology