Sarah Tew/CNET

Google on Thursday was hit with a lawsuit by New Mexico Attorney General Hector Balderas, alleging the search giant is illegally collecting data on school children.

The suit says Google is collecting the personal information through a program the company has with New Mexico's school districts, in which it provides Chromebooks and access to G Suite for Education apps for free. Those apps include Gmail, Calendar and Google Docs.

The practice would run afoul of the Children's Online Privacy Protection Act, or COPPA, a federal law that regulates data collection from sites with users who are under 13 years old. The lawsuit accuses Google of collecting information on students' locations, their passwords, what websites they've visited, what they've searched for on Google and YouTube, their contact lists and voice recordings.

Balderas also said in the lawsuit that Google "mined students' email accounts" and "extracted" information for advertising purposes until 2014.

"Student safety should be the No. 1 priority of any company providing services to our children, particularly in schools," Balderas said in a statement. "Tracking student data without parental consent is not only illegal, it is dangerous; and my office will hold any company accountable who compromises the safety of New Mexican children."

Google denied the accusations in the lawsuit.

"These claims are factually wrong. G Suite for Education allows schools to control account access and requires that schools obtain parental consent when necessary," Google spokesman Jose Castaneda said in a statement. "We do not use personal information from users in primary and secondary schools to target ads. School districts can decide how best to use Google for Education in their classrooms and we are committed to partnering with them."

The New Mexico complaint comes as Google faces broader scrutiny from a coalition of 50 state attorneys general -- including Balderas -- across the country. They're investigating Google's digital advertising operation, as well as other aspects of the company's business, in a high-profile antitrust probe.

This isn't the first time Google has faced criticism over children's data. In September, the US Federal Trade Commission slapped a record $170 million fine, as well as new requirements, for YouTube's violation of COPPA. In response, the video site made major changes to how it treats kids videos, including limiting the data it collects from those views.

Originally published Feb. 20, 11:35 a.m. PT.

Update, 1:16 p.m. PT: Adds statement from Google.