In September of 1998, the show Will & Grace debuted at what might have been the worst possible moment.

The show arrived on NBC just one year after Ellen’s groundbreaking coming out episode on ABC … and her show’s subsequent drop in ratings and swift cancellation. Following that, many believed that any primetime show with a gay lead was cursed to fail. Not only that, but especially in its first season the show also came in for heavy criticism from gay viewers who said that it did real harm by deepening stereotypes, using slurs, and making queer people look bad.

But it also racked up 18 Emmy wins, ranked as one of the highest-rated shows on television for years, and even came back for a three-year revival, leaving an indelible impact on television, culture, and politics. But looking back … was that impact a good thing or a bad thing?

Will & Grace was the brainchild of two young TV writers named Max Mutchnick and David Cohen, longtime friends who met in their early teens through a drama program in the late 1970s. They’d written for a handful of shows through the '80s and '90s — The Wonder Years, Dream On, Good Morning Miami — and had made a solid connection with NBC entertainment boss Warren Littlefield, who came to them for ideas when it looked like the successful sitcom Mad About You was about to wind down.

Max and David proposed a show that seemed like it would have a shaky chance of getting green-lit. It was an ensemble comedy about two straight couples and their neighbors — a gay man and his female best friend, based loosely on Max’s friendship with a woman he dated before coming out as gay.

As bad luck would have it, 1997 was a terrible time to pitch a show with a gay lead. Ellen had just come out on her show, earning huge ratings, massive controversy, and an almost-immediate plummet in ratings. Her coming out was blamed for the ratings sag, which dragged down viewership across the whole night on ABC (though it’s worth noting that ABC pulled back on promoting the show and added a parental warning to many episodes).

“It became a program about a character who was gay every single week,” said ABC president Bob Iger at the time. “And I think that was just too much for people.” (Iger is now the head of Disney.)

Ellen was cancelled after the next season in 1998, and conventional wisdom at the time was that audiences simply didn’t want to see gay characters on TV. That’s probably why, early on, Max and David’s pitch received notes like, “What do you think of having the character of Will not be gay?”

Nevertheless, they brought it to Warren Littlefield, hoping the specter of Ellen’s cancellation could be overlooked. He listened to their pitch, and then told them that he wanted them to make some cuts. But to their surprise, he didn’t tell them to remove the gay character — he wanted them to cut everyone else.

“That's the center of the show,” he said, indicating the close connection between the gay man and his best friend. “That's the relationship I want to examine."

As it turned out, Warren had pitched something very similar a decade earlier to NBC’s then-head Brandon Tartikoff. At the time, Warren said, he was told “get the fuck out of here.” Television wasn’t ready for a gay lead character in primetime … but maybe, he thought, times had changed. TV was still reeling from Ellen’s failure, but Warren, Max, and David had noticed an interesting recent trend in successful films that examined the friendships between gay men and straight women: Object of My Affection, As Good as it Gets, My Best Friend’s Wedding. While most TV executives were fleeing in terror from anything gay, Warren saw an opportunity to be one of the first shows to explore a type of story that had been kept largely away from broadcast television.

They enlisted Jim Burrows to direct their pilot — sitcom royalty, Jim had worked on hits such as The Mary Tyler Moore Show, Taxi, Cheers, Friends, and many more — and assembled a cast. It took some persuasion, as all four of their first choices to play the leads turned them down at first: When offered the part of Will, Eric McCormack balked at signing a lengthy commitment to NBC; Debra Messing was so exhausted from a recently-canceled sci-fi show that she didn’t even want to consider playing Grace at first. Megan Mullally and Sean Hayes were initially more interested in playing leads than comedy-sidekicks Karen and Jack. But a series of frantic phone calls, meetings, and a late-night heart-to-heart at Debra Messing’s house over a bottle of vodka changed their minds. All four actors signed on, and in the spring of 1998 they were ready to shoot a pilot and see if this crazy idea could work.

Meanwhile, NBC executives were getting nervous. Some outright hated the concept, like west coast head Don Ohlmeyer (whose instincts weren’t always the best — he was responsible for firing Norm McDonald from Saturday Night Live). And over the summer, early critical reaction made everyone more worried.

When the show was presented to TV critics, it was met with intense skepticism and a barrage of questions about how they could possibly succeed where Ellen had failed. It was as if any show with gay leads was automatically assumed to be cursed. It was starting to look like it might not matter how good the show was, if audiences weren’t even willing to give it a chance.

So NBC and the Will & Grace team hit on a surprising solution: They would allow viewers to think that the show might not have a gay lead at all. Early marketing suggested that the show was a conventional rom-com about two straight friends, and Jim Burrows pushed for the main characters to kiss in the pilot. The thinking was that they would let viewers think that Will and Grace might romantically get together — even though they never would. But if the show could just hook viewers, they’d see how funny it was and would get over their squeamishness and stick around.

Will & Grace premiered in September of 1998 and it did … okay. Not great. Just okay. It picked up a small, devoted following — but a new unexpected problem quickly emerged. The show began to draw heavy criticism from gay viewers who felt that it painted them in a bad light, relied on stereotypes, and stripped its gay characters of any sexuality.

The Bay Area Reporter called Will a “token queer” and a “clone” who was so straightened out he only TALKED about being gay instead of actually BEING gay. The Advocate printed angry letters calling the characters “neutered,” and the show just “more of the same.”

The show addressed those criticisms in a clever roundabout way in an episode late in Season 1 entitled, “Will Works Out.” In the episode, Jack starts coming to Will’s gym, embarrassing him with his flamboyant mannerisms. Will’s frustration reaches a breaking point, and he uses the f-slur to describe his friend, leading to some justifiably hurt feelings and a heartfelt moment when Jack says that he’d rather be honest about who he is than afraid of what people think. It was a surprisingly thoughtful moment that does double-duty, exploring both Will’s rigid tendency to assimilate and revealing Jack’s unexpected depth.

But the use of a slur alarmed a sponsor, prompting them to drop the show. That, in turn, spooked NBC, which watched the show even closer than ever and sent notes about, as Jim Burrows recalled, “too many homo jokes.” It was starting to look like Will & Grace might not get to do anything that bold again, especially with ratings still just average.

But in Season 2, the writers took a chance and started exploring more specifically-gay storylines. Where the show previously tended to focus on the kind of wacky mishaps you could see on any other sitcom, it began tackling topics like coming out to family, same-sex dating, and the censorship of gay kisses on television. These were topics that set Will & Grace apart, since it was effectively the only show that could address them — and by the end of Season 2, they’d racked up 11 Emmy nominations and several wins, including for the episodes that focused on queer topics.

Feeling a little more confident, NBC moved the show to Thursday nights — a big roll of the dice, since Thursday was a massive American institution where NBC put its best-performing shows, such as Seinfeld and ER. Once thought of by many as devastatingly niche and doomed to fail, executives were clearly looking at Will & Grace in a very different light. And the move was successful: On Thursday, it found a massive audience, landing in the top ten of all television shows.

But that didn’t mean that TV had fully come around on gay characters. Following the eventual success of Will & Grace, the networks tried to conjure up some imitators. There was Some of My Best Friends, a gay-buddy comedy starring Jason Bateman; a new sitcom for Ellen; and Normal Ohio with John Goodman. All of these failed in their first year, and another called Five Houses didn’t even make it to air. It was starting to look like Will & Grace was an anomaly, and the post-Ellen curse was still dooming TV shows with gay leads.

After running for eight seasons, Will & Grace took its bow in 2006, bringing the series to (what everyone thought would be) a conclusion. When it went off the air, a vacuum was left behind — there were vanishingly few queer characters on network primetime shows, aside from an occasional storyline on Desperate Housewives.

But before long, new network shows stepped in to fill that vacuum: Glee, Ugly Betty, and Modern Family tended to feature more diverse queer characters with a broader range of family structures. And importantly, the shows were all hits, particularly with younger viewers. If Ellen had opened a door for gay leads, Will & Grace managed to push it open even wider, allowing even more shows to follow.

And the story of the show’s impact doesn’t end there. In 2012, then-Vice President Joe Biden was asked on Meet the Press if he supported marriage equality. This was just six months before he and Barack Obama were up for re-election, and no presidential administration had ever endorsed the freedom to marry. It seemed out of the question that Biden would say yes.

But to everyone’s shock, Biden said that his mind had changed, and he’d come around to support marriage equality. Not only that, but he specifically said that Will & Grace had done more to change American attitudes on the subject than anything else.

But could that be correct? Could a goofy sitcom really have had an impact on American opinion?

Well, fortunately, while Will & Grace was on the air, researchers at MIT conducted a study into whether the show was having an effect on viewers. Scientists had already studied the effect of knowing members of minority groups in real life, and that having personal interactions with queer people makes others more likely to support equality. But they were curious about what happens when people encounter minority groups through television shows.

What they found was remarkable: When members of the public watch shows with queer characters like Will & Grace and Six Feet Under, their attitudes are more likely to shift over time to be more favorable towards queer people. The context of the portrayal matters, they found: The effect, which they dubbed “parasocial contact hypothesis,” required that the queer characters be of equal status to straight peers, to share common goals, and to not be opposed by an authority figure. The exposure had to be sustained and non-superficial. When those criteria are met, audiences that watched shows with queer characters exhibited a shift in opinion (and an increase in positive attitudes) that was similar to meeting and getting to know queer people in real life.

Will & Grace happened to arrive at a particularly sensitive turning point for television. After taking a huge step forward with Ellen’s coming out, popular media was poised to take an even bigger step backwards, wiping away queer characters out of an unfounded fear about audience refusal to accept LGBTQ+ leads. But instead, Will & Grace debuted at just the right moment, won viewers over, and became a huge hit, holding back the industry’s regressive impulse to straighten itself out and opening the door to shows that pushed real social change by reaching millions of people across the country every single week.

“There would be no Modern Family without Will & Grace,” said actor Jesse Tyler Ferguson when he won an award for LGBTQ+ representation from the Paley Center in 2019 alongside Debra Messing. “They held the door open for us … We plan to hold the door open for those who want to come after us. And personally, I’m so excited to see what future talents do with that opportunity. It is my great hope that we continue to challenge our audiences. There are still so many stories to tell. We still have so much we can do to represent the LGBTQ+ community on television.”