The House of Representatives passed a bill Thursday aimed at keeping illegal immigrants out of the U.S. if they are members of criminal gangs.

The Criminal Alien Gang Member Removal Act passed in a 233-175 vote, and was backed largely by GOP lawmakers, and opposed by most Democrats. The legislation was introduced by Rep. Barbara Comstock. R-Va.

The bill would require illegal immigrants in gangs to be detained and deported, and ensures that gang members are not able to receive immigration benefits, including asylum, special immigrant juvenile status or temporary protected status.

"It will provide additional tools to law enforcement that will ensure that when [Immigration and Customs Enforcement] positively identifies a known alien gang member, they may act immediately," Comstock said on the House floor. "We don't have to wait until these brutal killers wield their machetes or leave another body on a children's playground."

Comstock's Northern Virginia district is home to members of the MS-13 gang, which has been responsible for eight deaths in the district since November, according to the congresswoman.

Reps. Peter King, R-N.Y., Raul Labrador, R-Idaho, and Bob Goodlatte, R-Va., were also key backers of the legislation.

Rep. Zoe Lofgren, D-Calif., an opponent of the bill, argued that the bill could have unintended consequences, including the potential targeting of religious groups who harbor illegal immigrants against deportation. She also warned that the Department of Homeland Security would have expanded authority to crack down on what the bill wrongfully allows to be thought of as a gang.

"In one fell swoop, this could turn nuns into gang members," Lofgren said.