“Empire” on Fox has become a huge hit and part of a new crop of TV shows to feature minorities in lead roles. (Chuck Hodes/Fox)

Before this year, Fox and ABC were two television networks in a slump, with abysmal ratings and only a few shows getting any buzz. But this season, the networks have hit on a surprising formula for success: airing television shows in prime time created by and starring minorities.

It used to be conventional wisdom in the industry that having more than one black family on television was risky, a play for too narrow an audience to be a success with ratings and advertisers. But viewers’ tastes and demographics have changed.

In prime time now, there is the new hit Fox show “Empire,” a soapy hip-hop drama starring ­Oscar-nominated actors Terrence Howard and Taraji P. Henson. ABC’s “Black-ish,” starring Anthony Anderson and Tracee Ellis Ross, portrays an upper-middle-class African American family. Other prime-time shows feature Hispanic women and their families, a South Asian comedian, an Asian American romantic lead actor and an Asian American family.

The ratings for Wednesday night’s “Empire” were the series’s biggest yet, with Nielsen releasing numbers showing that 11.3 million viewers tuned in.

“When I first heard the pitch, what got to me was the specificity of characters in this world that felt so authentic. I knew that with hip-hop, which crosses all demographics and borders, ‘Empire’ had tremendous potential,” Fox TV chief Gary Newman said in an interview. “Our strategy going forward is: Don’t be safe, don’t be derivative and swing for the fences.”

Indeed, the shows are taking on controversial topics, often with sophistication, and not only about race. “Empire” dives into the African American community’s struggle with homophobia. In “Black-ish,” upper-income parents Dre and Bow Johnson struggle to keep their African American children connected to their ethnic identities.

“What’s so in­cred­ibly exciting about what’s happening on TV is that we are moving beyond the political-correct period where certain language wasn’t used and certain issues weren’t discussed,” said Jason George, an African American actor and a leader of diversity efforts at actors’ union SAG-AFTRA. “Now, we are having frank conversations, conversations that anyone — not just African Americans — can relate to.”

“Empire” has also drawn criticism, though, for relying on cultural stereotypes and negative portrayals of African Americans.

“When you throw in three scheming sons — one gay — homophobia, murder, gutter language and explicit sex, you get what amounts to another reality TV show depicting black people behaving shamefully,” wrote Mary Mitchell, a columnist for the Chicago Sun-Times.

Darnell Hunt, director of the Ralph J. Bunche Center for African American Studies at UCLA, fears “Empire” could lapse into tropes about African Americans who are rappers, former drug dealers and gangsters.

“We’re only a few episodes in so far, but that is always a concern and we hope they can rise above that,” he said.

New opportunities

The changes to broadcast TV have been years in the making and largely a reaction to competition. Broadcast networks have battled to keep audiences that have been drawn to the buzzy excitement of provocative cable shows. More recent competition has come from streaming services such as Netflix and Amazon, whose series about women in prison and a transgender parent have become hits.

Until this season, ABC was struggling. Then it offered a slate of new programs deliberately focused on diversity. Its fortunes reversed. The network debuted “Cristela” by comedian Cristela Alonzo, the first Latina writer, director and lead actor in a network series. “Cristela” has ranked among the highest-rated shows among 18- to 49-year-olds, with about 5 million to 6 million people tuning in for each episode. “Black-ish” was quickly renewed after it drew huge ratings in the fall.

ABC’s biggest asset has been its long partnership with show runner Shonda Rhimes, who has churned hugely popular shows, including “Grey’s Anatomy,” which features a diverse cast of doctors; “Scandal,” starring Kerry Washington; and “How to Get Away With Murder,” led by actress Viola Davis. ABC signed another Rhimes pilot, “The Catch,” this week. Rhimes’s shows don’t necessarily deal with issues of race. They are dramas that happen to have leading black actresses and other minorities on their casts.

Meanwhile, the big movie studios have struggled to showcase minority actors and directors, even though they, too, face business pressures to change. The producers of “Lee Daniels’ The Butler,” for instance, said they encountered resistance from executives at major Hollywood studios who said that African American casts would not appeal to global audiences.

“Advertisers get it and they want to draw the biggest audience possible,” Hunt said. “The key to Shonda Rhimes’s success is to create diverse shows that don’t alienate any one race so that everyone can watch and engage.”

The opportunities in TV have lured minority actors away from movies.

Talent manager Vincent Cirrincione’s clients include several African American actresses, including Academy Award winner Halle Berry and “Empire” star Henson, who was nominated for a Oscar for her role in “The Curious Case of Benjamin Button.”

Now, nearly all of his clients are on casts for TV series.

“Taraji was in huge movies, but she wasn’t getting recognized in the way she is on ‘Empire,’ ” Cirrincione said. “She was just on Jimmy Fallon, she’s huge on Twitter, her audience is growing with each episode.”

“It’s our job to reflect America,” ABC-TV head Paul Lee said at a television critics conference this month, according to the Los Angeles Times. “We didn’t pick up these shows because they were diverse, we picked them up because they were great.”

Fox’s new hit

“Empire” co-creator Danny Strong didn’t think about race when he came up with the idea for the show. About two years ago, he was driving around Los Angeles and heard a news story about Sean “P Diddy” Combs on the radio.

Strong, who wrote and co-produced “Lee Daniels’ The Butler,” imagined that the over-the-top world of hip-hop could be the perfect subject for a TV show. And he immediately thought of a Shakespearean construct — putting a King Lear-themed family struggle at the center of a hip-hop story.

“It came to me in, like, 60 seconds,” Strong said. “The battle for a hip-hop empire in the form of a soap opera like ‘Dynasty’ or ‘Dallas,’ and the actors just happened to be African American because this involved the hip-hop world.”

With Fox, Strong and co-creator Lee Daniels dreamed of making it a blockbuster for TV. Timbaland helped produce original music. The cast included two Oscar nominees, Howard and Henson.

Fox poured massive resources into marketing, including the sponsorship of a pay-per-view boxing card in November and promos during National Football League games on Fox. Adidas shoes and jewelry were tied to the show.

The first episode drew strong ratings, but “Empire” has grown more popular with each episode, mostly because of word of mouth on social media.

Fans began to pick their favorites among the three sons vying for patriarch Lucious Lyon’s anointment as successor to Empire records.

It has been one of the top 10 talked-about shows on Twitter since its release, according to Nielsen Twitter TV Ratings.

Still, fans and critics praise the show for its exploration of homophobia in the African American community.

In the first episode, Lucious’s gay son, Jamal, is shown kissing his partner. Test audiences for Fox showed that ratings for the show plummeted during the scene. Strong and Daniels didn’t take it out.

“Our job as directors and writers is not to follow the culture but to reflect and address culture as great art and lead culture in a way by taking people to places where they are uncomfortable,” Strong said.