Education Secretary John B. King Jr. on Monday blasted state laws that prohibit public school students from using bathrooms designated for the opposite sex, calling them “hateful.”

Responding to a question about transgender students at an education conference for journalists in Boston, King called for the repeal of such laws, WRAL.com, the website of a television station in Raleigh, N.C., reported.

He said laws like North Carolina’s House Bill 2, which established bathroom access in government facilities to be determined by biological sex, are “deeply problematic” for children in schools.

King was a keynote speaker at the Education Writers Association’s annual conference, which includes many journalists.

King suggested the Education Department may investigate cases of such state legislation in North Carolina and elsewhere.

“I don’t want to get ahead of enforcement actions we may take in regards to North Carolina and Mississippi,” King said, WRAL.com reported. “My hope is legislators will realize they have made a terrible mistake.”

The Department of Education issued a guidance document in April 2014, stating that it would protect transgender students from discrimination under federal Title IX provisions.

Title IX protects students and school faculty from discrimination based on sex in education programs that receive federal financial assistance. If schools don’t comply with Title IX, they risk losing this money.

In December, The Daily Signal reported that the Department of Education investigated a school district in Cook County, Ill., for forcing a transgender student to use a separate locker room. The department threatened to strip the district of federal funding, and it backed down.

“North Carolina’s HB 2 is a commonsense bill that protects privacy and safety while allowing reasonable accommodations for transgender students,” Melody Wood, a research assistant at The Heritage Foundation, told The Daily Signal, adding:

It does not violate Title IX, which was originally passed to allow equal educational opportunity for women. In fact, Title IX explicitly states that it allows separate living facilities—which would include restrooms and locker rooms—for the different sexes.

Education reporters and others present at the conference tweeted about King’s remarks, made in response to a question about transgender students.  

The U.S. Senate confirmed King as education secretary in March. He succeeded Arne Duncan, President Barack Obama’s only other appointee in the Cabinet post.