Posse Comitatus Act
The Posse Comitatus Act is a United States federal law (18 U.S.C.§ 1385, original at 20 Stat. 152) signed on June 18, 1878 by President Rutherford B. Hayes. The purpose of the act - in concert with the Insurrection Act of 1807 - is to limit the powers of the federal government in using federal military personnel to enforce domestic policies within the United States.
Protect the American citizen from an invasion of criminals outside the USA seems to be within that law.