Warning: The following feature contains SPOILERS for Supergirl, season 5, episode 10, "The Bottle Episode."

The first episode of Superman villains, with Brainiac-5 and Lex Luthor entering into a secret alliance. While Brainiac-5 has always acted heroically in the past, there is reason to fear he may be preparing to follow in the footsteps of his infamous ancestor.

While Lex Luthor is indisputably Superman's arch-enemy, Brainiac may be the most powerful member of the Man of Steel's classic rogues' gallery. Whether he's in the form of an alien genius from the planet Colu or an artificial intelligence obsessed with collecting information, Brainiac has proven to be a worthy foe each time he's crossed swords with Superman. Small wonder then that Lex Luthor and Brainiac have ed forces on a regular basis to fight their mutual enemy in the comics. The two even had an alliance in the original Crisis on Infinite Earths comics, before they built an army made up of the villains of five worlds together.

Related: How Supergirl Will Be A Different Show After Crisis on Infinite Earths

The action of Supergirl season 5, episode 10, "The Bottle Episode," saw several of Brainiac-5's doppelgangers from other Earths mysteriously appear on Earth-Prime. One of them had managed to save his Earth by trapping it in a bottle before the Anti-Monitor could destroy it, but nearly destroyed it and Earth-Prime by opening the bottle too close to a populated world. Brainiac-5 was eventually able to defeat his other-self by deactivating the personality inhibitors that repressed his intelligence while enhancing his ability to control his emotions. Confronted by a version of himself he sensed could truly relate to the pain he was feeling in having lost his world and lost control, the alternate Brainiac-5 agreed to wait for the heroes of Earth-Prime to find a safe place where his Earth could survive and the bottle was transported to the Fortress of Solitude for safe-keeping.

Supergirl The Bottle Episode Seaspn 5 Braniac-5 and Lex Luthor Team-Up

This display of comion and intelligence convinced the rest of the Brainiacs to renounce their physical forms and with the Coluan hive-mind known as the Big Brain. Before disappearing, one of the Brainiacs (a female version from a reality where she was the director of the DEO) warned Brainiac-5 Prime that she had scanned the Lex Luthor of Earth-Prime and determined that he was searching for information on Leviathan; a secret organization Brainiac-5 had searched for before the Crisis, whose tracks had been completely covered when Earth-Prime was created.

The alternate Brainiac-5 said that events on Earth-Prime seemed to be preceding down the same path as on her Earth and that she and her allies had only wound up endangering their world by fighting Lex Luthor instead of focusing on the threat posed by Leviathan. To that end, she said that Brainiac-5 would have to "give up everyone and everything that you hold dear... until the world is safe." She further added that in order for Earth-Prime to survive, he would have to work with Lex Luthor in secret, because his allies would never appreciate why it was necessary.

Brainiac-5 took the advice to heart, broke up with his girlfriend, Nia, and approached Lex Luthor privately in the final scene of "The Bottle Episode." He explained to the surprised Luthor that he too was worried about the threat posed by Leviathan, but knew that his friends were short-sighted and that Supergirl would continue to work against Luthor even in the face of a common enemy. Lex agreed with Brainiac-5's assessment and accepted his help, cementing a secret partnership that can only end badly for the newly reborn Earth-Prime.

More: Batwoman Comes Out As A Lesbian After Crisis (& Supergirl Helps Her)