The Pennsylvania Senate advanced a measure on Tuesday that would cut off hundreds of millions of dollars in state subsidies to cities and counties that do not always honor detention requests from federal immigration authorities.

The measure targeting sanctuary cities dovetails with a national debate being spearheaded by Pennsylvania's U.S. Sen. Pat Toomey and President Donald Trump, both Republicans, as a top law-and-order priority.

The Republican-controlled Senate passed the bill, 37-12. Every Republican voted for the bill, as did three Democrats.

The policies of sanctuary cities vary, but the term generally refers to places where local government officials will only honor U.S. immigration detention requests when they are accompanied by an arrest warrant.

During debate on the Senate floor, Republicans said the bill was meant to end those cities' dangerous practices. Democrats countered that forcing cities to honor detention requests that are not backed by a warrant could trample on civil rights and expose the local governments to lawsuits.

The debate became emotionally charged when the bill's sponsor, Sen. Guy Reschenthaler, R-Allegheny, suggested that questions about the legislation being asked by Sen. Vincent Hughes, D-Philadelphia, were not relevant.

"Any question that I ask on the floor of the Senate is relevant, let's be clear about that," Hughes shot back.

The House and Senate each passed a similar bill last year, but the bills died amid disagreements between the chambers. Toomey has sponsored legislation in Congress that would punish sanctuary cities by withholding certain federal grants, and Trump last month said he would cut federal grants for sanctuary cities.

Democratic Gov. Tom Wolf's office said it was monitoring legislative and federal government activity on the issue. A spokesman said the office has concerns about the bill, including whether states can legally require that municipalities assist with the enforcement of federal immigration policy.

"We also have concerns about the impact on citizens and families from the loss of federal and state funding if municipalities or counties don't comply," spokesman JJ Abbott said.

Under the bill, Philadelphia, Pittsburgh and more than a dozen counties, including many of the most populous counties, could lose access to state subsidies that last year totaled $1.3 billion, according to a Senate Appropriations Committee analysis. That included law enforcement grants and money meant to protect neglected or troubled children, and the analysis cited a list of jurisdictions identified by the conservative Center for Immigration Studies.

The bill does not specify which state agency would determine which municipalities and counties qualify as sanctuary cities. Hughes said that as many as 32 counties could qualify.