Protesters hold signs as they listen to speakers at a rally outside City Hall in San Francisco in January. (Jeff Chiu/Associated Press)

In what appeared to be an act of defiance against President Trump and to the dismay of many in law enforcement, California lawmakers took a significant step toward making the state a so-called “sanctuary state.”

The California Senate on Saturday passed Senate Bill 54, controversial legislation that would protect undocumented immigrants from possible deportation by prohibiting local law enforcement agencies, including school police and security departments, from cooperating with federal immigration officials. It also forbids law enforcement from inquiring about a person’s immigration status.

The California Values Act provides an expansive protection to the state’s undocumented population, estimated to be about 2.7 million, at a time when the Trump administration continues to aggressively crackdown on those who are in the country illegally and on so-called sanctuary cities — communities that limit local law enforcement’s cooperation with immigration agents.

The strictly party-line vote sends the bill to California Gov. Jerry Brown (D), who is expected to sign it in to law.

Kevin de León (D-Los Angeles), president pro tempore of the state Senate and California’s most powerful Latino politician, introduced the bill in December. It sailed through the state Senate and Assembly without Republican support.

“Once signed into law and enacted, SB 54 will prevent state and local law enforcement officers and resources from being commandeered by President Trump to enforce federal laws,” de León said in a statement Saturday, adding later: “Our undocumented neighbors will be able to interact with local law enforcement to report crimes and help in prosecutions without fear of deportation — and that will make our communities safer.”

Assemblywoman Lorena Gonzalez Fletcher (D-San Diego) said California’s “families, schools, workplaces and communities” will be safer.

Those in law enforcement, however, disagreed.

In a brief statement Saturday, Department of Justice spokesman Devin O’Malley described the passing of SB 54 as an “abandonment of the rule of law” that places Californians at risk and undermines national security.

“Just last month another illegal alien allegedly killed a community volunteer, yet state lawmakers inexplicably voted today to return criminal aliens back onto our streets,” O’Malley said.

The California State Sheriff’s Association, which has vocally opposed the bill, said that limiting public safety agencies’ ability to cooperate with immigration agents places communities at risk.

“We are disappointed that the Legislature chose political symbolism over public safety in approving SB 54,” the association said in a statement.

Brown and de León reached a compromise this week that allows law enforcement to have some flexibility. For example, the bill gives officers discretion to cooperate with immigration agents if a person has been convicted of a serious or violent felony and any felony punishable by imprisonment in a state facility.

Officials can report a person who has been convicted in the past 15 years of crimes such as unlawful possession or use of a weapon, driving under the influence, or drug- and gang-related offenses, as long as those offenses were felonies.

The revision also requires the Department of Corrections and Rehabilitation to give inmates credits toward reducing their sentences, regardless of their immigration status, if they complete educational and rehabilitative programs.

President Trump has threatened to go after sanctuary cities, which provide protections for illegal immigrants. (Claritza Jimenez/The Washington Post)

The compromise was accepted by immigration advocates but did not persuade law enforcement organizations to support the bill. In a statement after the deal was reached Monday, the California State Sheriff’s Association said that despite the changes, “the bill still goes too far in cutting off communications with the federal government.”

“Our overarching concern remains that limiting local law enforcement’s ability to communicate and cooperate with federal law enforcement officers endangers public safety,” the association said.

Senate Republican Leader Pat Bates (Laguna Niguel) said in a statement that the latest amendments “may have removed some obstacles.”

But the bill, she added, “would still impose unnecessary restrictions. These restrictions will make it more difficult to stop dangerous criminals from being released into our communities.”

California is not the first state to pass a sanctuary law. The Oregon legislature passed a similar bill in 1987.

Chicago Mayor Rahm Emanuel hailed a federal judge's decision on Sept. 15 barring the Justice Department from denying public-safety grants to sanctuary cities. (Reuters)

The vote came just a day after a legal blow to the Trump administration’s crackdown on sanctuary cities. A federal judge on Friday blocked the Justice Department from withholding grant funds from Chicago and other cities that refuse to cooperate with immigration authorities.

Last August, a federal judge in Texas temporarily blocked parts of a state law that was supposed to outlaw sanctuary cities and penalize local officials for not cooperating with federal deportation efforts.

Brewing in the White House and on Capitol Hill is a debate on what to do with the hundreds of thousands of young undocumented immigrants who were brought to the country as children, after Trump announced that his administration is ending an Obama-era program granting legal status to “dreamers.” Departing from a campaign promise to end the Deferred Action for Childhood Arrivals program, or DACA, Trump said that he favors some protections for dreamers, whom he called “good, educated and accomplished young people.”

Matt Zapotosky and Maria Sacchetti contributed to this report.

Read more:

Judge rules Justice Department can’t keep grant money from uncooperative sanctuary cities

Federal judge blocks Texas’ harsh anti-sanctuary law

Chicago sues Justice Department over new police grant rules targeting sanctuary cities