California Gov. Jerry Brown (D) said Thursday that he signed legislation to bar state law enforcement officials from enforcing federal immigration law, making the state a sanctuary for immigrants in the country illegally.

The measure, passed last month by the overwhelmingly Democratic California legislature, will bar California police and sheriffs from asking about a detainee’s immigration status. It will also block those agencies from complying with detainer requests from federal Immigration and Customs Enforcement (ICE) agents.

An estimated 65 percent of all deportations result from cooperation between state and local law enforcement and federal ICE and Customs and Border Protection officers. The new law, dubbed the California Values Act, requires schools, health facilities and court houses to establish policies limiting immigration enforcement that may be executed on their premises.

Brown had been expected to sign the law after he and its prime sponsor, state Senate President Kevin de Leon (D), hammered out an agreemen t to give law enforcement agencies more discretion about when they could notify federal immigration officials about convicted offenders in their custody.

“This bill protects public safety and people who come to California to work hard and make this state a better place,” Brown said in a statement announcing the amendments.

Federal immigration officials would still be allowed to interview those in the custody of California law enforcement agencies, but they would not be permitted to maintain permanent office space in state prisons or local jails.

Those changes mollified some law enforcement groups, including the California Police Chiefs Association and others that opposed the initial version de Leon introduced.

De Leon said the measure was needed, especially as the Trump administration ramps up immigration enforcement measures, which de Leon calls “a mass deportation strategy.”

But the amendments did not satisfy legislative Republicans, who voted against the measure en masse. The bill passed on party-line votes.

The law sets California on another collision course with the Trump administration, which has sought to withhold federal grant funding from states, counties and cities that do not abide by federal immigration detainer requests.

California and Connecticut are among the 142 jurisdictions listed by ICE officials in Washington as having refused detainer requests, in a report in February. Current California law requires the state to comply with those requests only if the detainee has been convicted of a felony or another serious crime.