Google Inc won a landmark victory over media companies as a Manhattan federal judge threw out Viacom Inc's $1 billion lawsuit accusing the Internet company of allowing copyrighted videos on its YouTube service without permission.

Viacom claimed tens of thousands of videos on YouTube, resulting in hundreds of millions of views, had been posted based on its copyrighted works, and that the defendants knew about it but did nothing to stop illegal uploads.

But in a 30-page ruling, U.S. District Judge Louis Stanton said it would be improper to hold Google and YouTube liable under federal copyright law merely for having a general awareness that videos might be posted illegally.

Mere knowledge of prevalence of such activity in general is not enough, he wrote. The provider need not monitor or seek out facts indicating such activity.

Viacom said it plans to appeal to the U.S. Second Circuit Court of Appeals.

It called Stanton's ruling fundamentally flawed, saying it reflects neither Congress' intent behind copyright laws nor recent U.S. Supreme Court decisions.

The lawsuit went to the heart of perhaps the biggest issue facing media companies in the last decade: how to win Internet viewers without ceding control of TV shows, movies and music.

It was seen as a test of the Digital Millennium Copyright Act, a 1998 federal law making it a crime to produce technology to circumvent anti-piracy measures, and limiting liability of online service providers for copyright infringement by users.

New York-based Viacom is controlled by Sumner Redstone and owns cable networks such as MTV and Comedy Central as well as the Paramount movie studio.

It alleged that copyrighted works uploaded illegally included The Daily Show with Jon Stewart, South Park, SpongeBob SquarePants, and others.

These issues are really important for content creators to protect their intellectual property against the usage by online aggregators, said Laura Martin, an analyst Needham & Co. It is really important for content creators to get paid.

This is the beginning, not the end, she went on. Sumner won't roll over and die on this.

Kent Walker, Google's general counsel, on the company's blog, called the ruling an important victory not just for us, but also for the billions of people around the world who use the web to communicate and share experiences.

SAFE HARBOR

Google and YouTube argued they were entitled to safe harbor protection under the digital copyright law because they had insufficient notice of particular alleged infringements.

Stanton agreed, saying it would contravene the structure and operation of the law to impose responsibility on service providers to discover which postings infringe copyrights.

The judge added that the act's notification scheme works efficiently, saying that after Viacom on Friday, February 2, 2007 sent a mass takedown notice covering 100,000 videos, YouTube had removed virtually all of them by the following Monday.

Stanton directed the parties to submit a report by July 14 to address any remaining issues in the case.

Certainly for Google, there's been so many regulatory and legal negative headlines about them, so to see them on the winning side of something will certainly be a positive, said analyst Benjamin Schachter at Broadpoint AmTech.

Based in Mountain View, California, Google bought YouTube in November 2006 for about $1.65 billion.

Earlier this year, YouTube estimated that users upload as much as 24 hours of video to its website every minute.

In court papers, Google had contended that even Viacom managers had uploaded videos after the lawsuit was filed.

SERVICE PROVIDERS TAKE ACTION

Google has developed technology to allow content owners to automate the identification of copyrighted material on YouTube, helping them remove protected content quickly.

It has not been alone in taking steps to protect owners' copyrights online. Media powerhouses such as Microsoft Corp and Walt Disney Co have established their own guidelines.

The film and television industries learned the lessons of the music industry that you need to fulfill consumer demand in an approved manner and keep those who offer unauthorized access at the fringe, Gabelli & Co analyst Christopher Marangi said.

Today, audiences are accustomed to looking for TV shows or feature films on websites such as ComedyCentral.com and Hulu.com, which is owned by Disney, Rupert Murdoch's News Corp and General Electric Co's NBC.

YouTube itself, meanwhile, is changing as executives try to enter licensing agreements to add full-length programing to the short user-uploaded clips that dominate the site.

This was a test of the ground rules for the distribution and consumption of online content, Marangi said.

Stanton's decision was posted online just before U.S. markets closed on Wednesday.

Viacom Class B shares closed up 5 cents at $35.27 on the New York Stock Exchange on Wednesday. Google shares closed down $4.20, or 0.9 percent, at $482.05 on the Nasdaq. Shares of both companies were little changed after-hours.

The cases are Viacom International Inc et al v. YouTube Inc et al, U.S. District Court, Southern District of New York, No. 07-02103; and The Football Association Premier League Ltd et al v. YouTube Inc et al in the same court, No. 07-03582.

(Reporting by Jonathan Stempel and Paul Thomasch; Additional reporting by Ritsuko Ando and Jennifer Saba; editing by Andre Grenon and Tim Dobbyn)