In a victory for online privacy advocates but a blow to advertisers, a federal judge in California has ruled Google may have violated wiretapping laws by scanning and reviewing users' Gmails.

Google has long scanned Gmail messages to then target advertising to its users. The company has argued the practice is perfectly within the confines of both federal and state eavesdropping laws because Gmail users give up their privacy as part of Gmail's Terms of Service contract.

U.S. District Judge Lucy Koh disagreed, saying those Terms of Service “did not explicitly notify Plaintiffs that Google would intercept users’ emails for the purposes of creating user profiles or providing targeted advertising.”

What's more, even if Gmail account holders consented to having their emails searched, the people with whom those users are communicating didn't. Google has claimed that users of, say, Microsoft's Outlook, should know that Google will view their mail when sent to a Gmail account.

Koh was unconvinced, saying she “cannot conclude that any party — Gmail users or non-Gmail users — has consented to Google’s reading of email for the purposes of creating user profiles or providing targeted advertising.”

The ruling, part of a proposed class action against Google, is a big win for privacy advocates, who have complained that technology companies have too much access to personal information and are not overt enough in explaining how customer information and data are used.

The chorus for more protections has only gotten louder since it was revealed that companies like Google shared information with the U.S. government as the National Security Agency spied on American emails, texts and phone calls.

Still, companies have long found that there is a potentially high value proposition for advertisers in targeting marketing toward users based on their interests. Google, for instance, has long tied advertising to search results from users. Gmail, it argues, is an extension of that.

But Google has found itself more and more in the crosshairs of the privacy-protection crowd. Earlier this month, the company found out its capture of data over open Wi-Fi routers also could violate federal wiretapping laws. Google captured data through cars sent throughout the company to record images for its Google Street View maps. It has said it did so to improve its location-services features, but broader content was captured by the cars.

Google is not alone. In theory, Judge Koh's ruling could affect other companies that mine free email for information to match with advertisers. Yahoo mail, for instance, has a Terms of Service that allows for broader data capture.