WASHINGTON (CBS/AP) — The House has approved legislation aimed at punishing so-called “sanctuary cities” like San Francisco that refuse to cooperate with federal immigration authorities.

The bill is a response to the shooting death in San Francisco of Kathryn Steinle, allegedly by an immigrant with multiple criminal convictions who was in the country illegally.

The legislation passed on a largely party-line vote of 241-179 on Thursday. The bill would block some federal funding for communities that don’t cooperate in providing immigration information to federal authorities.

Republicans called it a needed response to Steinle’s death.

But Democrats called it a punitive attack on immigrant communities — and accused Republicans of following Donald Trump’s lead in demonizing Latinos.

On Thursday, the White House threatened to veto the bill.

TIMELINE: How San Francisco Became A Sanctuary City For Undocumented Immigrants

An Obama administration statement says the legislation would threaten civil rights by allowing law enforcement officials to gather immigration status information from any person at any time. The statement says such an approach would lead to mistrust between local communities and law enforcement agencies.

The father Steinle told the Senate Judiciary Committee Tuesday that Congress should push forward with efforts to close legal loopholes that currently allow local authorities to decide if they will cooperate with federal immigration authorities.

Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.