Updated

The House has narrowly defeated an attempt to bar immigrants living in the country illegally from enlisting in the U.S. military. Opponents tied the measure to Donald Trump's presidential campaign.

Rep. Paul Gosar's amendment has failed Thursday by a vote of 211-210. The Arizona Republican says he wants to close what he calls President Barack Obama's "backdoor amnesty program."

Rep. Ruben Gallego opposed Gosar's amendment. The Arizona Democrat says Congress shouldn't let anti-immigrant posturing block the military's recruiting goals. The immigrants can enlist if they have special language or medical skills.

The potential recruits were brought to the U.S. illegally as children. They are protected from deportation under the Obama administration's Deferred Action for Childhood Arrivals program. They also receive temporary work permits if they meet certain requirements.