In this combination photo, actress Olivia de Havilland appears in Rome on Oct. 4, 1968, left, and actress Catherine Zeta-Jones portrays de Havilland in a scene from the FX series, “Feud: Betty and Joan.” (AP Photo; FX/AP)

A California appeals court on Monday threw out a lawsuit by Olivia de Havilland over the way she was portrayed in the FX docudrama “Feud: Bette and Joan,” ruling that the legendary actress known for her roles in “Gone With the Wind” and other classics had no right to control how the show’s creators depicted her.

In a unanimous opinion, the Second District Court of Appeal found that FX and Ryan Murphy, the show’s creator, were protected under the First Amendment from de Havilland’s claims that the show cast her in a “false light,” used her likeness without permission and should have compensated her.

The ruling is a win not just for FX and Murphy, but also for screenwriters and producers generally. Had the court ruled in de Havilland’s favor, it could have opened the door for other public figures — or anyone, for that matter — to file aggressive legal challenges if they objected to the way they were portrayed in fictional works.

“Whether a person portrayed in one of these expressive works is a world-renowned film star — ‘a living legend’ — or a person no one knows, she or he does not own history,” the three-judge panel wrote in a 38-page opinion. “Nor does she or he have the legal right to control, dictate, approve, disapprove, or veto the creator’s portrayal of actual people.”

De Havilland, 101, came up during Hollywood’s golden age, the period spanning from the end of silent films to the late 1950s. Her portrayals of Melanie Hamilton, Scarlett O’Hara’s sister-in-law in “Gone With the Wind,” and Maid Marian in “The Adventures of Robin Hood” launched her into stardom in the late-1930s, and she went on to win two Oscars, among numerous other accolades.

“Feud,” which premiered in March 2017, presents a dramatized version of the intense rivalry between Bette Davis and Joan Crawford during the filming of the 1962 thriller “Whatever Happened to Baby Jane?” De Havilland, who was a close friend of Davis, is played by Catherine Zeta-Jones. The show was nominated for 18 Emmy awards.

Though the role of de Havilland was limited to 17 minutes of screen time in the eight-episode series, the actress filed suit against FX and Murphy last June, saying she was unfairly portrayed as a vulgar gossip-peddler and arguing they didn’t have permission to use her as a character.

Her case centered largely on a scene in which her character calls her sister Joan Fontaine a “b—-,” when in reality she had called her a “dragon lady.” De Havilland also objected to a joke her character tells about Frank Sinatra’s heavy drinking.

A lower court expedited the case because of de Havilland’s advanced age and allowed the case to proceed last fall. The defense team asked the court to strike the complaint under a California law that bars meritless lawsuits that are intended to suppress protected speech.

The appeals court reversed the lower court’s ruling and ordered the case tossed, finding that the show was constitutionally protected as a fictionalized work based on real-life events.

Established First Amendment precedent protects authors who take real-life stories and transform them into fictional works. The situation might have been different had FX used de Havilland’s name or likeness to sell a physical piece of merchandise, according to the opinion.

But in this case, the judges wrote, FX was safe because “Feud” was “transformative” — that is, it was a creative work that drew from a variety of source material and didn’t derive its value principally from de Havilland’s celebrity.

“The reversal is a victory for the creative community, and the First Amendment,” Murphy said in a statement in. “Today’s victory gives all creators the breathing room necessary to continue to tell important historical stories inspired by true events. Most of all, it’s a great day for artistic expression and a reminder of how precious our freedom remains.”

De Havilland’s attorney Suzelle Smith knocked the ruling as a “pro-industry decision” and said she planned to appeal.

Smith told the Hollywood Reporter in a statement that the court had “taken on itself the role of both Judge and jury, denying Miss de Havilland her Constitutional rights to have a jury decide her claims to protect the property rights in her name or to defend her reputation against knowing falsehoods.”

With regard to de Havilland’s character using the word “b—-” instead of “dragon lady,” the court found that either term would have had essentially the same effect on the audience. “B—-” wasn’t highly offensive to an average person, the judges wrote, and it was close enough to her actual words that the creator’s decision warranted First Amendment protection.

The same went for the Frank Sinatra crack, the judges found. They called it a “lighthearted” remark that fit with Zeta-Jones’s portrayal of a “wise, witty, sometimes playful woman.”

Indeed, the court wrote, much of the series portrayed de Havilland in a positive light. Zeta-Jones played the de Havilland character as “beautiful, glamorous, self-assured and considerably ahead of her time in her views on the importance of equality and respect for women in Hollywood.”

FX and Murphy were supported in the case by the Motion Picture Association of America, Netflix and other organizations, which argued that First Amendment concerns vastly outweighed de Havilland’s rights over her image and likeness.

The court agreed with them, finding that de Havilland’s position could invite legal action against “all books, films, plays and television programs that accurately portray real people.”

“The trial court’s ruling leaves authors, filmmakers, playwrights and television producers in a Catch-22,” the judges wrote. “If they portray a real person in an expressive work accurately and realistically without paying that person, they face a right of publicity lawsuit. If they portray a real person in an expressive work in a fanciful, imaginative — even fictitious and therefore ‘false’ — way, they face a false light lawsuit if the person portrayed does not like the portrayal.”