California Gov. Jerry Brown signed "sanctuary state" legislation Thursday that extends protections for immigrants living in the United States illegally - a move that gives the nation's most populous state another tool to fight President Donald Trump.

Brown's signature means that police will be barred from asking people about their immigration status or participating in immigration enforcement activities starting Jan. 1.

Jail officials only will be allowed to transfer inmates to federal immigration authorities if they have been convicted of certain crimes.

California is home to an estimated 2.3 million immigrations without legal authorization.

"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 statement.

The measure came in response to widespread fear in immigrant communities following Trump's election. He railed against immigrants in his campaign and promised to sharply ramp up the deportation of people living in the U.S. illegally.

Democrats hope blocking police from cooperating will limit the reach of U.S. Immigration and Customs Enforcement officers.

The measure introduced by the Democratic Senate leader, President Pro Tem Kevin de Leon of Los Angeles, cleared the Legislature with support only from Democrats. Republicans said it will protect criminals and make it harder for law enforcement to keep people safe.

The bill, SB54, originally would have severely restricted the authority of police officers to cooperate with federal immigration authorities. At Brown's insistence, it was scaled back to allow cooperation in jails.

Police and sheriff's officials, including jail officers, will still be able to work with federal immigration authorities if a person has been convicted of one of about 800 crimes, mostly felonies and misdemeanors that can be charged as felonies. But they will be barred from transferring immigrants to federal authorities if their rap sheet includes only minor offenses.

The changes convinced the California police chiefs association to drop its opposition, while sheriffs - elected officials who run jails - remained opposed. ICE Acting Director Thomas Homan has condemned the measure, saying California is prioritizing politics over public safety.

California's Democratic political leaders have enthusiastically battled Trump and his administration with lawsuits, legislation and fiery public rhetoric, particularly about immigration and the environment.

Some law enforcement officials say the impact of the sanctuary measure likely will be minimal because it bans immigration enforcement activities that few agencies participate in.

Immigrant rights advocates say it's important to codify restrictions with the force of law while adding new ones. For them, it's a rare victory during Trump's presidency.

The measure was dubbed a "sanctuary state" bill because it sought to expand so-called sanctuary city policies that have long been in place in some of California's biggest cities, including Los Angeles and San Francisco.

Brown and de Leon have said the bill does not give safe harbor to immigrants, particularly after the concessions Brown demanded.