The state of Texas can legally bar state agents from enforcing federal gun control. Refusal to cooperate with federal enforcement rests on a well-established legal principle known as the anti-commandeering doctrine.
Simply put, the federal government cannot force states to help implement or enforce any federal act or program. The anti-commandeering doctrine is based primarily on five Supreme Court cases dating back to 1842. Printz v. U.S. (1997) serves as the cornerstone. For the majority, Justice Scalia wrote, in part:
“We held in New York that Congress cannot compel the States to enact or enforce a federal regulatory program. Today we hold that Congress cannot circumvent that prohibition by conscripting the States’ officers directly. The Federal Government may neither issue directives requiring the States to address particular problems, nor command the States’ officers, or those of their political subdivisions, to administer or enforce a federal regulatory program. It matters not whether policymaking is involved, and no case by case weighing of the burdens or benefits is necessary; such commands are fundamentally incompatible with our constitutional system of dual sovereignty”
No determination of constitutionality is necessary to invoke the anti-commandeering doctrine. State and local governments can refuse to enforce federal laws or implement federal programs whether they are constitutional or not.