Federal courts handed Google’s YouTube a victory Thursday in a six-year-old lawsuit filed by Viacom Inc. alleging copyright infringement.

The case has flip-flopped in federal courts, with YouTube winning the first round in 2010 when U.S. District Judge Louis L. Stanton dismissed Viacom’s allegations that YouTube had violated copyrights by displaying videos of Viacom shows uploaded to the site by users. Stanton ruled that YouTube was shielded by the safe harbor provisions of the Digital Millennium Copyright Act by removing such videos when asked to and granted Google’s request for a summary judgment.

Resolution, in this case, however, has been anything but summary. Last year, an appeals court judge gave Viacom a temporary victory by directing the lower court to review the lawsuit again to see if YouTube knew that pirated material was being uploaded and deliberately turned a blind eye.

In a decision filed Thursday in U.S. District Court of Southern New York, Stanton reaffirmed his original stance. “The burden of showing that YouTube knew or was aware of the specific infringements of the works in suit cannot be shifted to YouTube to disprove,” Stance said. “Congress has determined that the burden of identifying what must be taken down is to be on the copyright owner.”

Further, simply knowing that there are infringing videos on the site isn’t a violation of the law. “Knowledge of the prevalence of infringing activity, and welcoming it, does not itself forfeit the [DMCA] safe harbor,” he wrote, dismissing Viacom’s allegations. “To forfeit that, the provider must influence or participate in the infringement.”

Lawrence Iser, a copyright attorney with Kinsella Weitzman Iser Kump & Aldisert in Santa Monica, said a reverse ruling would have had devastating consequences for numerous Internet services that let users upload and share content.

“The District Court relies on the plain language of the DMCA to squarely place the burden of notification of infringing materials on the copyright owner," Iser said. "Were it otherwise, as Viacom contended, the 'safe harbor' contemplated by Congress in the DMCA would turn into a copyright minefield for service providers, ultimately threatening their existence.”

Google, which purchased YouTube in 2006 for $1.8 billion, hailed the outcome.

“The court correctly rejected Viacom’s lawsuit against YouTube, reaffirming that Congress got it right when it comes to copyright on the Internet,” Kent Walker, Google’s Senior Vice President & General Counsel, said in a statement. “This is a win not just for YouTube, but for people everywhere who depend on the Internet to exchange ideas and information.”

In a statement, Viacom said: “This ruling ignores the opinions of the higher courts and completely disregards the rights of creative artists. We continue to believe that a jury should weigh the facts of this case and the overwhelming evidence that YouTube willfully infringed on our rights, and we intend to appeal the decision.”

Ironically, Google’s Chief Executive Officer, Larry Page, during an earnings call on Thursday pointed to the company’s success in garnering licensing agreements with all major labels, publishers and Hollywood studios in putting together its Google Play store, which sells all manner of digital content, including titles from Viacom properties. Google Play was cited during the earnings presentation as one of the company’s key businesses moving forward.

For the first quarter of 2013, Google posted a 22% uptick in its core revenue, outside of its recently acquired Motorola business, to $13 billion, up from $10.6 billion. Net income of $3.3 billion, or $10.13 cents a share, was up from $2.9 billion, or $8.88, a year earlier. The results beat Wall Street analysts’ forecasts. Google’s stock, which suffered a 2.1% decline alongside the rest of the stock market to close at $765.91, bounced back 1.5% to $777.50 in after-hours trading following the earnings release.