Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

SACRAMENTO, Calif. — Democrats in the California Senate ramped up their fight Tuesday against President Donald Trump, advancing a bill that would provide statewide sanctuary for immigrants by keeping local law enforcement from cooperating with federal immigration authorities.

The move in the nation's largest state — home to an estimated 2.3 million immigrants without legal authorization — came days after Trump launched a crackdown on immigration and sanctuary cities across the nation.

The state Senate Public Safety Committee approved the measure with a 5-2 party-line vote after Trump signed an order threatening to withdraw some federal grants from sanctuary cities.

"We want to make sure that police officers don't abandon their beat and go enforce immigration laws," said Senate President Pro Tem Kevin de Leon of Los Angeles, the author of the measure.

NBC Bay Area: San Francisco Becomes First City to Sue President Trump Over Sanctuary Cities

Republicans and law enforcement groups said the bill would make it harder for law officers to work together to fight crime.

"I think this bill is making it that much more difficult for the federal authorities to get the most dangerous criminals that we want to deport to keep our communities safe," said Sen. Jeff Stone, a Temecula Republican who voted against the measure.

Some Republicans have criticized the Democratic reaction to Trump's policies, saying bombastic rhetoric and provocative legislation will inflame tensions with the president and harm California.

State Sen. President Pro Tem Kevin de Leon discusses his measure SB54 after the Senate Pubic Safety Committee passed the bill on Jan. 31 in Sacramento, California. Rich Pedroncelli / AP

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Many of California's largest cities — including Los Angeles, San Francisco and Sacramento — already have sanctuary policies that prohibit police from cooperating with immigration authorities.

SB54 would extend those policies statewide, prohibiting police officers and jailers from arresting or detaining people solely for immigration violations unless a judge issues a warrant. State and local law enforcement agencies could not help investigate immigration violations, inquire about someone's immigration status or provide addresses to immigration officers.

Law enforcement databases would be off limits for immigration investigations, though police officials could still discuss someone's previous arrests and convictions with immigration agents.

The legislation also seeks to limit immigration enforcement activity at schools, courthouses and shelters.

Democrats said the bill is needed to protect people such as Victor Alvarez, a U.S. citizen who told the committee that his father was pulled over for a broken taillight and deported hours later.

"Since my dad was deported the whole family has been suffering," Alvarez said. "I had to put school on hold just to support the family."

Related: 'Sanctuary Cities' Vow to Resist trump Order Despite Funding Threat

San Francisco sued Trump on Tuesday, claiming the executive order that would cut funding from sanctuary cities is unconstitutional and a "severe invasion of San Francisco's sovereignty."

The federal government cannot "put a gun to the head of localities," City Attorney Dennis Herrera said, arguing that the order violates states' rights and the law.

San Francisco receives about $1.2 billion a year in federal funding for services that include housing, health and social services, and homelessness.

The suit argues the city is safer when all people, including those who are living in the country illegally, feel safe reporting crimes.

Later Tuesday, the state Senate Judiciary Committee was expected to consider fast-tracked legislation that would allow the state to spend an undisclosed amount of money to provide lawyers for people facing deportation.

The debate over sanctuary cities escalated in 2015 after Kate Steinle, 32, was fatally shot in the back by Juan Francisco Lopez-Sanchez, who was in the country illegally after multiple deportations to his native Mexico.

Lopez-Sanchez, who told police the gun fired by accident, had been released from a San Francisco jail despite a request from federal immigration authorities that he be held in custody for possible deportation. Trump often cited the Steinle case during the presidential campaign.

Many other cities and counties in California also refuse to detain immigrants for deportation agents out of legal concerns after a federal court ruled that immigrants can't be held in jail beyond their scheduled release dates.

Since then, federal agents have been asking local law agencies to provide information about immigrants they're seeking for deportation, if not hold them.

The California sanctuary legislation now goes to the Senate Appropriations Committee.

It's unclear how it might fare if it reaches the Assembly. Speaker Anthony Rendon, D-Paramount, has resisted Trump's policies, but the Assembly also has a bloc of moderate lawmakers in swing districts who have balked at legislation favored by the more liberal Senate.

"The Assembly will evaluate the bill if and when it gets to our house," said Kevin Liao, a spokesman for Rendon.