The House voted Thursday to let the federal government strip grant funds from so-called "sanctuary cities" that have policies in place preventing them from cooperating with federal officials on immigration.

The No Sanctuary for Criminals Act is aimed at putting pressure on these jurisdictions by letting the federal government deny them grants from the Justice Department and the Department of Homeland Security. It passed the House in a mostly party-line vote, 228-195.

The bill is a response to Republican complaints that sanctuary cities are improperly refusing to cooperate with federal officials on immigration, which is preventing those officials from ensuring that dangerous and possibly criminal aliens are detained and deported. To that end, U.S. Immigration and Customs Enforcement today can ask local law enforcement officers to detain someone suspected of being deportable for an extra 48 hours, but they are simply requests and many local jurisdictions do not comply with them.

The denial of federal grant funding is one way to pressure the jurisdictions to comply, but it would also let the families of victims of illegal immigrants to sue jurisdictions that fail to work with the federal government.

Both President Trump and Attorney General Jeff Sessions urged the House to pass the bill, which was sponsored by House Judiciary Chairman Rep. Bob Goodlatte, R-Va.

"This simple, straightforward bill combats dangerous sanctuary policies that permit criminals to go free," Goodlatte said on the floor.

Democrats like Rep. Luis Gutiérrez, D-Ill., blasted the bill as a means for Republicans to distract from other issues.

"Healthcare not going well? Let's hate on some Mexicans today," he said. "The Republican Party has had Mexican fever."