Yahoo faces a nationwide class action lawsuit as a California judge ruled the company guilty of illegally accessing the content of emails sent by non-Yahoo mail users to Yahoo mail users, and using the information gathered to boost advertising revenue.

U.S. District Judge Lucy Koh ruled that those who got sent or received emails since October 2011 can sue the company as a group, making the case a class action lawsuit under the federal Stored Communications Act for alleged privacy violations.

She also said a class of non-Yahoo Mail subscribers in California since Oct. 2, 2012 may sue as a group under that state's Invasion of Privacy Act, Reuters reported.

The accusers seek to ban Yahoo from spying on emails, and must pay damages.

In its defense, Yahoo argued that some of the plaintiffs continued to email Yahoo subscribers, despite being aware of Yahoo's activities and, in doing so, consented to Yahoo accessing users' emails, BBC News reported.

Judge Koh rejected Yahoo's arguments.

A class action lawsuit can make it easier for the group to receive larger damages and a wider range of resolutions at a lower cost. Plaintiffs estimate that they have more than one million members for the lawsuit.