It’s Lex Luthor’s worst nightmare.

Television is recruiting more comic-book superheroes than the Justice League of America, from the steely eyed members of ABC’s “Agents of S.H.I.E.L.D.,” featuring cameos from the blockbuster “Avengers” films, to “The Flash,” the highest-rated series in CW’s history.

And the squad is expanding. Last week, Netflix released an entire season of “Daredevil,” the first of four anticipated shows based on Marvel Comics characters. In March, Sony PlayStation Network jumped into the world of original programming with “Powers,” a comic-book inspired series in which human cops clean up after superpowered criminals. CBS is developing a drama that revolves around DC Comics’ Supergirl.

“I think we’re really in the early stages of this trend,” said Dan Jurgens, Minnesota’s most renowned comic-book artist, best known for the “Death of Superman” story line. “TV is already doing well across the board, but as they do more shows, they’ll get even better at it.”

In truth, TV is late to the game.

Comic books themselves have never been cooler. According to Comichron, a website that tracks comic-book data, North American sales have nearly tripled since 2001, to $780 million in 2013.

San Diego’s Comic-Con convention has become a cultural event on par with the Sundance Film Festival and South by Southwest, proof that interest in comic-book superheroes expands far beyond the nerds on “The Big Bang Theory.”

And then there’s the big screen. Movies based on comic-book heroes have scored at the box office, with at least two of the top five ticket sellers for three years running.

“When I first started writing in film and television in the ’70s and ’80s, I had to hide the fact that I had been working in comic books, because people thought it was a dismissible form of art,” said Gerry Conway, who killed off Gwen Stacy in “The Amazing Spider-Man” and created the Punisher for Marvel. “Now, most of the people who are in the business grew up reading comic books. They are influencing the decisions that get made for popular culture.”

Jonathan Palmer is putting that newfound respect to good use. He helped start Project Superhero, a nonprofit program that uses caped crusaders to inspire at-risk youths through reading, watching TV and role-playing.

“I think superheroes are our modern mythology,” said Palmer, who is executive director of the Hallie Q. Brown Community Center, a social service agency in St. Paul. “They give us a message that we should always try our best. But it’s not all sparkle and light. They struggle. Look at Peter Parker. He’s got girl trouble and can’t pay the rent.”

Inviting superfriends

No series charted the changing attitude toward superheroes better than CW’s “Smallville,” which ran from 2001 to 2011. Early seasons didn’t give a young Clark Kent much of a chance to flex his muscles. That would change.

“In the beginning, it was really about teen angst,” Jurgens said. “As it went along, it added appearances from other DC characters like Aquaman. When they showed up, ratings would go up. It lasted 10 years because it transformed into something else.”

“Smallville” was not the first show to spotlight the Man of Steel. The popular superhero series “The Adventures of Superman” premiered in 1952 and was followed by such hits as “Batman” in the 1960s and “Wonder Woman” in the ’70s.

But those shows consisted primarily of shallow and even corny bits, whether it was Adam West doing a loopy dance or Lynda Carter spinning herself into the image of a pinup girl.

Today’s characters are much more complex.

In “Gotham,” set during a time when Bruce Wayne is just a child, future Police Commissioner James Gordon must cope with an ethically challenged police department. In “Arrow,” the protagonist struggles to keep his vow to stop crime without killing the bad guys.

“I think we’re watching a revolution with regards to the way superhero characters are portrayed,” said CBS Entertainment President Nina Tassler. “There’s a humanity. They are flawed. There’s a relatability.”

In comic books, those attributes were once largely identified with Marvel characters, while DC’s crime fighters were more stoic and removed. Superman, for example, seemed to think humor was as toxic as Kryptonite.

Jurgens, who has worked for both DC and Marvel, thinks that’s because DC was created in the 1930s, when Depression-era audiences craved purer heroes, while Marvel took off in the much more complicated 1960s. But it’s becoming harder to tell those two worlds apart.

“Writers are more interested in taking on these characters and giving them more depth,” he said. “The stark differences are melting away.”

Greg Berlanti, an executive producer for “The Flash” and “Arrow,” said writing those shows is surprisingly similar to the storytelling on such Berlanti dramas as “Dirty Sexy Money” and “Everwood.”

“It’s probably hard to believe, but we get most excited in the writers’ room when we’re creating the characters’ stories and their journeys,” he said. “I’ve been able to participate in family shows and teen dramas, and it often feels just the same.”

Flash forward

Advances in technology also have helped make the genre more attractive. Several comic-book aficionados credit “The Flash,” which made its debut last fall, for raising the bar on special effects.

“With every episode we are coming up with new and different ways to do things,” said writer/producer Andrew Kreisberg. “The one thing TV can do really well, as opposed to movies, is get much deeper into the emotional lives of the characters and tell longer story arcs. But if you’re not keeping up with the effects, that stuff tends to get lost.”

One area where TV has not made significant advances is in representing both genders. Marvel’s “Agent Carter,” the first female-led superhero show since “Wonder Woman,” got boffo reviews, but its first-season finale in February drew only 4 million viewers, which makes a return to the airwaves a long shot.

But TV executives seem eager to keep trying. CBS is developing “Supergirl” and Netflix is committed to the Spider-Man spinoff “Jessica Jones.”

That’s most likely due to the growing number of fangirls. Paul Fricke, a cartoonist who teaches comic-book design at the Minneapolis College of Art and Design, one of the few schools in the country that offers a major on the subject, said that when he first started going to comic-book conventions it was nearly impossible to find women. Now 30 to 40 percent of attendees are female, he said. As for his classroom, the number of female students is usually between 50 and 90 percent.

“For decades, superheroes were all about young male power fantasies,” said Fricke, who watches “The Flash” with his two teenage daughters. “But with more material being created by females, that’s shifting.”

Clearly, spending a night at home watching superheroes save the world is no longer a pop-culture sin.

“All of us who got picked on in high school are now at the top of the heap as opposed to the bottom,” said Len Wein, who co-created Swamp Thing and Wolverine. “The geeks have inherited the Earth.”