More than 2.3 million undocumented immigrants in California are now officially protected under a new state sanctuary law.

Governor Jerry Brown on Thursday signed the California Values Act, which bars police departments from detaining people based on their immigration status and prevents immigrants from being delivered to Immigration and Customs Enforcement (ICE) officers unless they are convicted of certain felonies and misdemeanors.

The policy also will limit the amount of personal information federal immigration officials can access on undocumented immigrants. Senate Bill 54, which has been criticized by President Donald Trump and is seen by many as a direct challenge to his recent crackdown on illegal immigration, will go into force on January 1. 

The bill’s main sponsor, Senate President Kevin de León, praised the timing of the bill, stating it was needed in the climate of what he described as Trump’s “mass deportation strategy,” The Hill reported. He said California was “building a wall” against Trump, a nod to the president’s repeated, but unrealized, promise to build a wall between Mexico and the U.S. 

California currently has at least 35 cities that have sanctuary status, with several facing off with the federal government over Attorney General Jeff Sessions’s attempts to block sanctuary cities from receiving federal funds. Sessions also spoke out against Senate Bill 54, calling it “unconscionable.”

In a statement during the bill signing, Brown said, “These are uncertain times for undocumented Californians and their families, and this bill strikes a balance that will protect public safety while bringing a measure of comfort to those families who are now living in fear every day,” ABC News reported.

“This bill protects public safety and people who come to California to work hard and make this state a better place,” he added.

The latest version of the measure allows federal immigration authorities to go into jails to question undocumented immigrants and to work with California correctional officials. The California Police Chiefs Association changed its position on the issue, from opposed to neutral, after those changes.

Roughly 2.3 million undocumented immigrants live in California, the largest population in the nation, compared with other states. Critics say more undocumented immigrants could now move to California to seek protection.