The Justice Department is suing California over legislation that bans federal agents from wearing masks and requires them to identify themselves, claiming the laws threaten the safety of federal officers as they conduct anti-immigrant operations in the state.

The complaint, filed Monday in the U.S. District Court for the Central District of California, refers to a pair of bills that Democratic Gov. Gavin Newsom signed in September. One of them, the No Secret Police Act, bars officers from wearing masks on the job, with exemptions for the California Highway Patrol and SWAT teams, and for medical reasons, while the No Vigilantes Act requires nonuniformed federal agents to have visible identification.

The Justice Department contends the laws endanger federal agents and that wearing masks allows the officers to “protect their identities and provide an extra layer of security.”

“Law enforcement officers risk their lives every day to keep Americans safe, and they do not deserve to be doxed or harassed simply for carrying out their duties,” U.S. Attorney General Pam Bondi said in a statement. “California’s anti-law enforcement policies discriminate against the federal government and are designed to create risk for our agents. These laws cannot stand.”

Both laws are set to take effect in January, but legal challenges are likely to delay the implementation.

“If the Trump administration cared half as much about public safety as it does about pardoning cop-beaters, violating people’s rights, and detaining U.S. citizens and their kids, our communities would be much safer,” Izzy Gardon, a spokesperson for Newsom’s office, said in a statement. “We’ll see the U.S. Department of Justice in court.”

California Democrats have framed the laws as an effort to protect residents from the federal government’s aggressive immigration raids and prevent officials from acting with impunity. Armed and masked federal agents have been documented while conducting violent arrests across the country, sparking fear among immigrant communities and leading to accusations of racial profiling. The practice has garnered intense criticism, including from Democrats and civil rights groups.

Other states, including Illinois and Massachusetts, are considering similar legislation.

This article was originally published on MSNBC.com