A US court has ruled that Google must reveal the viewing habits of every person who has ever used its online video site, YouTube.

Viacom, owner of movie studio Paramount and MTV Networks, requested the information as part of its €630m copyright infringement lawsuit against the popular online video service and its parent company, Google.

Judge Louis Stanton of the US District Court for the Southern District of New York ordered Google yesterday to turn over as evidence a database with usernames of YouTube viewers, what videos they watched when, and users' computer addresses.

Privacy activists from the Electronic Frontier Foundation said in a blog post the order 'threatens to expose deeply private information' and violated the Video Privacy Protection Act, a 1988 federal law passed after Supreme Court nominee Robert Bork's video rental habits were revealed.

Representatives of both companies said they were looking to work out how to comply with the court order to share video data while ensuring personally identifiable information is secure.

Viacom responded in a statement that it needs the data to demonstrate video piracy patterns that are the heart of its case against YouTube. But it sought to diffuse privacy fears, saying it had no interest in identifying individual users.

'Viacom has not asked for and will not be obtaining any personally identifiable information of any user,' it said.

'Any information that we or our outside advisors obtain...will be used exclusively for the purpose of proving our case against YouTube and Google (and) will be handled subject to a court protective order and in a highly confidential manner.'

Google senior litigation counsel Catherine Lacavera said her company was looking to resolve the issue quickly in a way that balanced Viacom and other plaintiffs' need for evidence in the case while 'carving out some space for user privacy'.

Ms Lacavera said her company was pleased the court's decision had put limits on evidence discovery, including refusing to allow Viacom access to YouTube's search technology or to users' private videos on the site.

But the Google attorney called on Viacom to allow YouTube to anonymize user data - in other words, redact rows of data containing usernames or unique computer Internet addresses.

In closed-door hearings ahead of the ruling, Google attorneys had argued against turning over such data without eliminating personally identifiable information.

'We are disappointed the court granted Viacom's overreaching demand for viewing history,' she said. 'We will ask Viacom to respect users' privacy and allow us to anonymize the logs before producing them under the court's order.'