Google uses software to scan users' emails for keywords that are then used to target advertising at those users. ( iStock)

Google must face two separate class action lawsuits over its collection of user data from Gmail and Streetview, judges in California ruled on Wednesday.

Two federal judges ruled against Google, which had argued the lawsuits had no merit and should not go to court.

The cases, based on dozens of suits launched by individuals who said Google had invaded their privacy, will force Google to defend its record in court.

“Google uses Gmail as its own secret data-mining machine, which intercepts, warehouses, and uses, without consent, the private thoughts and ideas of millions of unsuspecting Americans who transmit email messages through Gmail,” lawyers for the plaintiffs argued on July 11, opposing Google’s motion to dismiss the case.

Data gathered from Gmail, Google's email program used by half a billion people worldwide, was used to direct ads at users and was a form of illegal wiretapping, the lawyers said.

In its efforts to dismiss the case, Google said the scanning of Gmail messages was an “ordinary business practice," akin to detecting spam or viruses or filtering messages into folders

Federal wiretap law exempts interception of communication if it is necessary in a service provider’s “ordinary course of business,” but Judge Lucy Koh did not accept Google's argument.

“In fact, Google’s alleged interception of email content is primarily used to create user profiles and to provide targeted advertising — neither of which is related to the transmission of emails,” she wrote in the ruling that will allow the case to go forward.

A separate wiretapping lawsuit involves Google Street View vehicles that secretly collected personal information from unencrypted home computer networks.