Gov. Jerry Brown is expected to sign the California Values Act, passed by lawmakers Saturday, which would make the state a "sanctuary state" with new protections for undocumented immigrants.

The 27-11 vote, along party lines, was reached after lengthy negotiations. But immigrant rights groups applauded the final bill, noting that it represented a strong rebuke of President Donald Trump’s anti-immigration agenda, including the Justice Department's threats to withhold law enforcement grants from sanctuary cities.

"This was a hard-fought effort but the end product was worth the fight," said Jennie Pasquarella, Immigrants' Rights Director with the ACLU of California. "With SB 54, California will meaningfully improve state law to keep families together and communities whole—and not a moment too soon as the Trump administration continues its draconian and indiscriminate crackdown on immigrants."

Under the law, state and local law enforcement officers will not be permitted to ask about a person's immigration status during an arrest or police stop, and their communication with federal immigration authorities will be limited.

The bill also gives protections to inmates who are immigrants, allowing them to reduce their sentences by completing educational or rehabilitation programs, and ensures that schools, hospitals, libraries, and courthouses remain safe spaces for undocumented immigrants.

The original proposal by Democratic state senator Kevin De Leon would have also prohibited state and local police from reporting undocumented immigrants to federal authorities unless they had committed violent or serious crimes.

The bill that is headed to Brown’s desk allows communication with Immigration and Customs Enforcement (ICE) regarding anyone who has committed any of the 800 crimes listed in the California Trust Law, which includes some misdemeanors and non-violent crimes. ICE agents will also still be able to enter county jails.

Even after the negotiations, the bill is the most ambitious of its kind; in 1987 Oregon passed a law barring state and local officers from detaining anyone solely on immigration charges, and state lawmakers have proposed strengthening that law this year with amendments similar to the measures introduced in California.

Proponents of the California Values Act cited residents' fear of law enforcement amid the looming threat of deportation as a vital reason to pass the bill.

"Now, more than ever, it is imperative that California law clearly distinguish state and local law enforcement officers from federal deportation agents," said Pasquarella. "At a time when police data indicates that domestic violence and sexual assault reporting is plummeting among Latinos, California has a moral obligation to ensure law enforcement agents treat everyone fairly, no matter their background, what they look like, or where they are born."