Is this legal? The facts about Trump's use of National Guard troops

Donald Trump has already sent National Guard troops to Los Angeles and Washington D.C., with threats to go into many more cities. The justification and legality for all this are being hotly debated.