Pushing back against mounting criticism of California’s sanctuary policies, Gov. Jerry Brown on Thursday signed a bill placing strict limits on the disclosure of a person’s immigration status in open court.

Approved in the Senate with bipartisan support last week, Senate Bill 785 was introduced in response to news reports of ICE agents tracking down undocumented immigrants in courthouses across the country. It takes aim at a tactic that advocates say is keeping many immigrants from testifying in court, reporting crimes or simply showing up to pay a ticket.

“Our courthouses should be places of justice, not places where immigrants are threatened with deportation,” said Senator Scott Wiener, one of the bill’s authors, in a statement Thursday. “This law makes everyone in our community safer by ensuring that witnesses and victims of crime are not afraid to report crimes, go to court, and hold criminals accountable.

U.S. Immigration and Customs Enforcement declined to comment.

The law goes into effect immediately and comes as President Trump and Golden State leaders again face off on immigration. During a White Houseroundtable Wednesday with Southern California leaders who oppose the state’s sanctuary laws, Trump compared undocumented immigrants to “animals.”

“We have people coming into the country, or trying to come in — we’re stopping a lot of them,” he said. “You wouldn’t believe how bad these people are. These aren’t people, these are animals, and we’re taking them out of the country at a level and at a rate that’s never happened before.”

Shortly after Trump’s comments spread, Brown accused the president of “lying on immigration, lying about crime and lying about the laws of CA.”

Wiener’s office said some attorneys are revealing the immigration status of victims or witnesses who come forward to participate in court cases, even when it’s not relevant, creating a “chilling effect” that can prevent others from coming forward.

In a 2017 letter to U.S. Attorney General and former Department of Homeland Security John Kelly, California Chief Justice Tani G. Cantil-Sakauyeexpressed concern over reports that ICE agents are “stalking undocumented immigrants in our courthouses to make arrests” and asked immigration officials to keep enforcement tactics out of state courts.

“Our courts are the main point of contact for millions of the most vulnerable Californians in times of anxiety, stress and crises in their lives,” she said.

“Enforcement policies that include stalking courthouses and arresting undocumented immigrants, the vast majority of whom pose no risk to public safety, are neither safe nor fair.”

The only group on record that opposed the bill was the California News Publishers Association, which argued it would hurt the public’s interest by making some proceedings secret, hindering reporting.

A directive from U.S. Immigration and Customs Enforcement released in January allows immigration agents to enter courthouses to “discreetly” arrest targeted convicted criminals but bars them from detaining anyone else who may be undocumented.

“Federal, state, and local law enforcement officials routinely engage in enforcement activity in courthouses throughout the country because many individuals appearing in courthouses for one matter are wanted for unrelated criminal or civil violations,” the document said. “ICE’s enforcement activities in these same courthouses are wholly consistent with longstanding law enforcement practices, nationwide.”