An illegal immigrant tried taking a rifle from a Texas National Guard soldier at the U.S.-Mexico border Tuesday while a group of migrants were being detained, authorities said.