If you were hanging out at a gay bar on a Saturday night in 1986, you’d want to be sure you had a good seat before the clock rolled over to 9 pm. That’s when the music would stop, everyone would shut up, and all eyes would turn to the TV monitors so everyone could watch The Golden Girls.

Premiering in the mid-80s, The Golden Girls was an unlikely hit — and a lucky accident. Though we know it now as a beloved TV classic, it wasn’t even supposed to be a real show at first. Proposed as a joke at NBC, it only came to life thanks to an executive who realized the concept was so crazy it just might work; and also a groundbreaking, boundary-pushing producer.

On paper, the concept seems like it could never catch a mainstream audience: Four ladies of advanced age, sharing a house in Miami and lusting after men? Forget it. And yet it was an instant hit, particularly with gay audiences. So how did a show that was never supposed to be wind up becoming NBC’s #1 hit, and why does it remain a near-universal cultural touchstone even for young queer viewers who hadn’t yet been born when it originally aired?

The Golden Girls began its life as a casual joke in the middle of an incredibly boring network promo in September of 1984. NBC aired an hourlong special to promote its upcoming season, and someone had the goofy idea of promoting the new show Miami Vice by having the two elderly-lady stars of Night Court and Remmington Steele come out on stage to banter about retirement activities while lusting after the hunky Vice stars. “This isn’t Miami Nice,” Doris Roberts jokes.

Out in the audience, NBC executives noticed that there was something magic about putting a spotlight on two seasoned actresses — a character type generally relegated to a side-character on TV. As it happened, network head Brandon Tartikoff had been looking for a way to adapt the classic rom-com How to Marry a Millionaire into a TV show, and he realized that making the characters elderly might just be the way to do it.

But at that point, there wasn’t much more to the concept than that — until NBC brought in producer Susan Harris to develop the idea (and to find a better title than the proposed “Ladies Day”).

Harris had a history of taking big bold swings with shows like Soap, which featured the first regular gay character on a successful US sitcom (played by Billy Crystal). But she’d also just had a string of flops, with unmemorable shows like I’m a Big Girl Now with Martin Short, and Hail to the Chief (which also featured a recurring gay character). The success of the show — which Harris renamed to The Golden Girls — would depend largely on casting.

Harris couldn’t have been more fortunate with the talent she gathered, as documented in the book Golden Girls Forever. First there was Estelle Getty, who’d struggled as an actress her entire life until just a few years earlier, when she was a hit in Harvey Fierstein’s Torch Song Trilogy. Getty was visiting LA for just a few weeks when she lucked out with an audition for the show.

After that came Rue McClanahan and Betty White, who’d recently worked together on the show Mama’s Family. Rue was known for her innocent, wide-eyed characters and Betty for playing man-hungry Sue Ann Nivens on The Mary Tyler Moore Show, but for The Golden Girls they were going to reverse that typecasting and go against audience expectations. When celebrated actress Bea Arthur, whom Harris had been courting for the role of Dorothy, found out about that casting choice, she signed on — and rehearsals started three days later.

When the show premiered in September of 1985, one year after the “Miami nice” joke, it was clear they had an instant hit on their hands. It was the number-one show that week, with a quarter of all TV sets in the country tuned to watch the pilot. The show was especially received by gay audiences, who may have been particularly comfortable with the cast because they had all worked on queer-friendly projects in the past. Bea Arthur, for example, had done two gay episodes of the show Maude, including one in which she defends a gay bar from homophobic protestors. Rue McClanahan had appeared in Some of My Best Friends Are, a low-budget film set in a gay bar. Betty White had appeared on Love, Sydney, an NBC sitcom in which Tony Randall starred as a gay man. And Estelle was famous for Torch Song Trilogy, but had also played a lesbian in the show The Divorce of Judy and Jane (which The New York Times had called “impertinent”).

That history of the cast’s comfort with queer roles was replicated across the seven-season run of The Golden Girls, starting with the first episode. In episode one — and only that episode — the girls have a gay houseboy named Coco, a sort of continuation of Susan Harris’ groundbreaking Jody character from Soap. The idea was that Coco would be a younger voice on the show, but after the pilot it was clear that the chemistry really lay in the interaction between the women, so he was cut in favor of giving more time to Estelle Getty’s Sophia character.

The show avoided gay storylines for a while after Coco’s disappearance, but by season 2 that would change. A young TV writer named Jeff Duteil sent in a script he had written in which Dorothy’s daughter visits and comes out as a lesbian. Shows almost never accept unsolicited scripts — much less produce them — but as luck would have it, showrunners were looking for a queer storyline and they liked Jeff’s. After a few tweaks, like making the lesbian character Dorothy’s friend instead of her daughter, the episode “Isn’t it Romantic?” made it to air, winning widespread acclaim.

That was followed by episodes in which Blanche’s brother visits and comes out, then returns two years later with a boyfriend he intends to marry. There’s an episode in which one of the girls gives advice to a gay man on proposing to his partner. And there’s one that had particular resonance with gay audiences in which Betty White’s character Rose learns that she may have been exposed to HIV. Though the HIV-themed episode never explicitly mentions homosexuality, there’s a moving scene in the middle in which it’s made clear that AIDS is not “a bad person’s disease” — a message that was too-seldom heard on TV shows of the time.

Over the course of the show’s run, the attitude is unfailingly affirming to queer people. There’s the time Sophia says that if her kid was gay, “she wouldn’t love him one bit less.” There’s the time Blanche struggles to understand her gay brother and then comes around to accept him because she wants to be happy. The time a gay proposal is preceded with the words “love is love,” years before marriage equality would become a mainstream political issue. The time Rose responds to a lesbian crush by saying that she’s “flattered and proud that you think of me that way.”

And even when the topic isn’t explicitly queer, the characters share certain qualities with gay viewers, particularly when it comes to their sex lives. The Golden Girls is a show about people whose sexuality isn’t often depicted on television, but who manage to have exciting, fun, recreational sex. They’re not concerned with procreation — just having a good time, and speaking openly and honestly about taking precautions to protect the health of themselves and their partners.

What’s more, the cast were known for their strong allyship to the queer community, particularly Estelle, who was frequently seen at HIV fundraisers and even opened a hospice for people with HIV. In the years that followed the show’s airing, Betty White was a frequent advocate for marriage equality, and Rue appeared at Prides and fundraisers for LGBTQ+ causes.

Bea Arthur may have had the biggest impact of all, though. In 2005, a friend told her about the crisis of unhoused queer youth in New York, many of whom had been kicked out of the house by bigoted families. She leaped into action, hosting a fundraiser for the nonprofit The Ali Forney Center. And after she passed away, she left the center $300,000 in her will, allowing them to expand from a tiny operation with 12 beds to serving a thousand youths every year.

Many years ago, actress Rue McClanahan asked a gay man why they loved her character so much, and he answered, “are you kidding? We all want to be her!” And I think that’s certainly true — not just in terms of libido, but in terms of having a chosen family that’s loving and supportive. When you look across the seasons of The Golden Girls and at the careers of the cast, what you see is a show that repeatedly affirmed the lives and dignity of queer people, and performers who put their money where their mouth was in pursuit of equal rights. So no wonder queer people have boundless gratitude to this show for having been such a great friend.