LOS ANGELES (Reuters) - A bill to make California a sanctuary state, by preventing police from inquiring about immigration status and curtailing law enforcement cooperation with immigration officers, was signed into law by the governor on Thursday.

Slideshow ( 3 images )

The signing of the bill by Governor Jerry Brown, a Democrat, enacts on a state-wide level protections for illegal immigrants that exist in several cities, including Chicago and New York. Illinois approved a similar measure earlier this year.

The enhanced protections for illegal immigrants by California, the nation’s most populous state, sets the stage for a political battle with President Donald Trump, who has made a crackdown on illegal immigration one of his main priorities.

Senate Bill 54, which California lawmakers approved last month, bars local governments from forcing undocumented immigrants to spend extra time in jail so that immigration agents can pick them up for deportation.

It also prohibits police from asking about the immigration status of people during routine interactions. “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,” Brown said in a statement.

The law will take effect in January.

California leads the nation in its population of illegal immigrants, with more than 2.3 million people lacking legal status, according to Pew Research Center.

The U.S. Department of Justice immediately criticized Brown’s action.

“The state of California has now codified a commitment to returning criminal aliens back onto our streets, which undermines public safety, national security and law enforcement,” Department of Justice spokesman Devin O’Malley said in a statement.

Attorney General Jeff Sessions this year sought to cut off sanctuary cities from certain federal grants, but judges have blocked that effort.

The law will not affect major aspects of U.S. immigration enforcement, Brown noted in his statement. It does not prohibit sheriffs from allowing federal immigration authorities into their jails and does not freeze deportation proceedings for prison inmates, Brown said.