From https://en.wikipedia.org/wiki/Posse_Comitatus_Act
In 2006, Congress modified the Insurrection Act as part of the 2007 Defense Authorization Bill (repealed as of 2008). On September 26, 2006, President George W. Bush urged Congress to consider revising federal laws so that U.S. armed forces could restore public order and enforce laws in the aftermath of a natural disaster, terrorist attack or incident, or other condition. These changes were included in the John Warner National Defense Authorization Act for Fiscal Year 2007 (H.R. 5122), which was signed into law on October 17, 2006.
Section 1076 is titled "Use of the Armed Forces in major public emergencies". It provided that:
The President may employ the armed forces … to … restore public order and enforce the laws of the United States when, as a result of a natural disaster, epidemic, or other serious public health emergency, terrorist attack or incident, or other condition … the President determines that … domestic violence has occurred to such an extent that the constituted authorities of the State or possession are incapable of maintaining public order … or [to] suppress, in a State, any insurrection, domestic violence, unlawful combination, or conspiracy if such … a condition … so hinders the execution of the laws … that any part or class of its people is deprived of a right, privilege, immunity, or protection named in the Constitution and secured by law … or opposes or obstructs the execution of the laws of the United States or impedes the course of justice under those laws.
In 2008, these changes in the Insurrection Act of 1807 were repealed in their entirety, reverting to the previous wording of the Insurrection Act. It was originally written to limit presidential power as much as possible in the event of insurrection, rebellion, or lawlessness.