Google must take down a controversial anti-Muslim video on YouTube that sparked protests across the Muslim world because keeping it on the website violates the rights of an actress who sued after she was duped into appearing in the film, a divided federal appeals court ruled Wednesday.

In a 2-1 decision, the 9th U.S. Circuit Court of Appeals rejected Google’s arguments that being forced to take down the video, “Innocence of Muslims,” would be a prior restraint that would violate the company’s First Amendment protections.

Actress Cindy Lee Garcia proved the need to remove the video from YouTube, the appeals court concluded, in part because of ongoing death threats since it sparked violent protests after being first aired by Egyptian television in 2012.

“This is a troubling case,” Chief Judge Alex Kozinski wrote. “Garcia was duped into providing an artistic performance that was used in a way she never could have foreseen.”

Garcia sued after Google repeatedly rebuffed her pleas to take it down from YouTube. The actress had been cast in a minor role in a film called “Desert Warrior,” and paid $500 by director Mark Basseley Youssef, but the movie never materialized, according to court papers.

The actress discovered her scene had instead been used in the anti-Muslim film, and her voice dubbed over with an insult to the prophet Mohammed. The video generated worldwide attention, including an ongoing political debate over whether it played a part in inciting the fatal attacks on the U.S. embassy in Benghazi, Libya.

In her suit, Garcia maintained that YouTube’s unrivaled popularity gave the film a broad audience and that she had a right to get it removed because she had been misled by the director and retained copyright protections to her artistic work.

Google argued that taking the video down from YouTube would be futile because it is now in widespread circulation and that Garcia contributed to her own notoriety by filing the lawsuit. But the 9th Circuit disagreed and called the latter argument “preposterous.”

In a secret order filed last week, the 9th Circuit first notified Google that it must take down the video from YouTube “or any other platforms under (its) control.” That order was unsealed with Wednesday’s ruling.

Judge N. Randy Smith dissented, finding that Garcia did not have a clear protection against the use of her acting work and that an injunction against Google goes too far. A Los Angeles federal judge had previously sided with Google, refusing Garcia’s bid for an injunction.

A Google spokesman said the company “strongly disagrees with this ruling and will fight it.”

Google can ask the 9th Circuit to rehear the case with an 11-judge panel.

The ruling has sparked a debate on legal blogs and social media, with some free speech scholars expressing concern that the 9th Circuit extended copyright claims too far at the expense of the First Amendment.

“The idea that copyright is a tool that’s going to be used to censor speech we don’t like … that’s very dangerous,” said Julie Ahrens, director of copyright and fair use at Stanford University’s Center for Internet and Society. “It is a pretty stunning decision.”

But M. Cris Armenta, Garcia’s lawyer, called the ruling a “David versus Goliath victory.”

In a statement, Garcia said she was grateful for the ruling. “I am a strong believer and supporter of the First Amendment and have the right not to be associated with this hateful speech against my will,” she said.

Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz