By a 2-1 vote, a panel of the 9th U.S. Circuit Court of Appeals rejected Google's assertion that the removal of the film "Innocence of Muslims" amounted to a prior restraint of speech that violated the U.S. Constitution.
The plaintiff, Cindy Lee Garcia, had objected to the film after learning that it incorporated a clip she had made for a different movie, which had been partially dubbed and in which she appeared to be asking: "Is your Mohammed a child molester"
In a statement, Google said: "We strongly disagree with this ruling and will fight it."
Cris Armenta, a lawyer for Garcia, said she is delighted with the decision.
"Ordering YouTube and Google to take down the film was the right thing to do," Armenta said in an email. "The propaganda film differs so radically from anything that Ms. Garcia could have imagined when the director told her that she was being cast in the innocent adventure film."
The controversial film, billed as a film trailer, depicted the Prophet Mohammed as a fool and a sexual deviant. It sparked a torrent of anti-American unrest among Muslims in Egypt, Libya and other countries in 2012.
That outbreak coincided with an attack on U.S. diplomatic facilities in Benghazi that killed four Americans, including the U.S. ambassador to Libya. U.S. and other foreign embassies were also stormed in the Middle East, Asia and Africa.
For many Muslims, any depiction of the prophet is considered blasphemous.
Google had refused to remove the film from YouTube, despite pressure from the White House and others, though it blocked the trailer in Egypt, Libya and certain other countries.
In court filings, Google argued that Garcia appeared in the film for five seconds, and that while she might have legal claims against the director, she should not win a copyright lawsuit against Google.
The film has now become an important part of public debate, Google argued, and should not be taken down.
"Our laws permit even the vilest criticisms of governments, political leaders, and religious figures as legitimate exercises in free speech," the company wrote.
But Garcia argued that her performance within the film was independently copyrightable and that she retained an interest in that copyright.
A lower court had refused her request that Google remove the film from YouTube. In Wednesday's decision, however, 9th Circuit Chief Judge Alex Kozinski said Garcia was likely to prevail on her copyright claim, and having already faced "serious threats against her life," faced irreparable harm absent an injunction.
He called it a rare and troubling case, given how Garcia had been duped. "It's disappointing, though perhaps not surprising, that Garcia needed to sue in order to protect herself and her rights," he wrote.
The case is Garcia vs. Google Inc et al., 9th U.S. Circuit Court of Appeals, No. 12-57302.