On June 18, 1878, Congress passed the Posse Comitatus Act. This law made it a felony to willfully use "any part of the Army...to execute the laws" except where expressly authorized by the Constitution or by an act of Congress.
Learn more about the origins of the Posse Comitatus.