SACRAMENTO, Calif. (Reuters) - The California Senate approved legislation on Monday to restrict police agencies statewide in assisting federal efforts to deport illegal immigrants, after the bill was amended to give local law enforcement more leeway in dealing with those who are violent offenders.

Senate passage of the bill comes amid a heated debate in California and across the country over the “sanctuary” movement, in which many local government leaders have sought to shield immigrants facing President Donald Trump’s vow to step up deportations.

The measure now moves to the state Assembly, which like the Senate is controlled by Democrats but is a more conservative body as a whole.

State Senate President pro Tempore Kevin de Leon, a Los Angeles Democrat who is chief sponsor of the bill, called Monday’s action “a rejection of President Trump’s false and cynical portrayal of undocumented residents as a lawless community.”

“Undocumented residents commit crimes and are incarcerated at a lower rate than native-born residents,” he said.

The Trump administration has insisted that public safety is jeopardized when police refuse to cooperate in removing illegal immigrants who have been convicted of serious crimes.

Critics counter that enlisting police cooperation in rounding up immigrants for deportation undermines communities’ trust in local law enforcement, especially among Latino residents.

The thrust of de Leon’s bill prohibits state and local law enforcement anywhere in California from using their resources to investigate, detain, report or arrest people on the basis of their immigration status.

Police agencies in some of California’s biggest urban centers, including Los Angeles and San Francisco, already abide by such policies.

But days before Senate action on his bill, de Leon altered the measure to require state prison and parole officials to notify U.S. Immigration and Customs Enforcement (ICE) agents of upcoming release dates of inmates subject to deportation who also have convictions for serious or violent felonies.

An existing state law, the 2013 California Trust Act, generally forbids keeping individuals locked up longer than otherwise warranted - or after they make bail - at the request of federal immigration agents seeking to deport them, absent a court order.

As amended, de Leon’s bill also allows state and local police to take part in criminal justice task forces with federal agents so long as immigration enforcement is not the principal aim of the investigation.

Under another amendment to de Leon’s bill, the measure if enacted would take effect in January 2018, rather than immediately.