Talk about a smart casting move.

The CW’s Supergirl has cast Defiance alum Jesse Rath in the recurring role of Brainiac 5, TVLine has learned exclusively. Fall TV Premiere Award Winners

Half computer, half organic life and boasting a 12-level intellect, Brainiac 5 is a member of the Legion of Super-Heroes who travels to National City from the 31st Century to help Supergirl and the DEO battle Reign, the villain that L-Corp CEO Samantha Arias (played by Odette Annable) is on track to becoming.

Of course, Brainiac 5 in DC Comics lore has at times been more than a colleague of Supergirl’s. And as co-showrunner Andrew Kreisberg previously told TVLine of the character’s arrival, “Someone down the road will like Kara a lot, which will be a lot of fun.”

Rath will first appear in Season 3, Episode 10 — which is titled “Legion of Super-Heroes.” (In the comics, Mon-El aka Lar Gand/Valor also has an affiliation with the Legion, as does Saturn Girl — to be played by Amy Jackson.)

Update: “Episode 10 is called ‘Legion of Super-Heroes,’ and you can’t call it that without having the Legion of Super-Heroes in it,” Kreisberg tells TVLine. “We’ve hinted at the Legion going back to Season 1, when we saw the Legion ring in the Fortress of Solitude, so the Legion will have a presence.

“Supergirl is about to face her greatest nemesis in the three years that we’ve been doing the show — we feel that Reign is the best villain we’ve ever had — so it’s going to take all the allies that she can muster to take Reign down,” the EP adds. “The Legion will be playing a big part in that.”

On Smallville, Brainiac 5 was portrayed by Buffy alum James Marsters in the Season 10 episode “Homecoming.”

Supergirl continues its season tonight at 8/7c with Episode 5, “Damage.”

In addition to his run on Defiance, where he played Castithan crime family member Alak Tarr, Rath’s previous TV credits include No Tomorrow, Being Human and 18 to Life. He was also featured in the online miniseries Assassin’s Creed: Lineage, a prequel to the bestselling videogame Assassin’s Creed II. A diehard comic book fan, Rath is also one of the creators and stars of the popular web series Fans.

Want more scoop on Supergirl, or for any other show? Email InsideLine@tvline.com and your question may be answered via Matt’s Inside Line.