In full disclosure I should say that I was a National Guardsman long ago when in high school in Maine. My school friends decided to join the local rifle company of the 103rd Infantry Regiment and asked me to join with them. I did that and the following years were for me a strongly formative experience of community service in which we spent as much time in disaster relief work as we did in training for combat. When I left the state to go to college I was discharged from the Maine Army National Guard. I was a sergeant (E-5) 60 mm mortar squad leader . I have a deep sympathy for the citizen-soldiers of the Guard.
The National Guard is a portion of each state or territory's constitutionally created militia, a portion concerning which there are formal agreements between the federal military forces and the states. Under those agreements the federal government recognizes the commissions of National Guard officers, provides equipment, money for training time and a variety of other benefits. In return the units of the National Guard are trained to as close an approximation of Regular Army and Air Force standards as the time available will allow in a part time force.
The states and the federal government share control of the Guard. When the Guard is not in federal service, the governor of each state is the commander in chief of the state's National Guard.
There is a US federal law called the Posse Comitatus Act. This 19th Century law forbids the use of federal military forces for law enforcement in the US. There is a legislated "carve-out" that allows for participation in drug smuggling interdiction.
The National Guard when NOT in federal service is exempt from that law because they are not federal troops. Title 32 of the US Code makes it clear that the National Guard can be used for any legitimate state governmental function when ordered to do so by the state's governor. That would include law enforcement.
We are now told in the media that the National Guardsmen going to the border cannot be used for law enforcement and will function as a logistical, reconnaissance and administrative backup for the US Border Patrol. That may be so but it is not necessarily so. The US Secretary of Homeland Security has several time said that there are no present plans to use the Guard for law enforcement, but, pilgrims, that could easily change. pl