President Trump vowed Sunday night that, if necessary, he would use the U.S. military to assist in controlling the looting and violent protests taking place throughout the country, which has raised questions on what degree the armed forces can legally get involved with domestic law enforcement.

The framework for this is largely set by two laws: the Posse Comitatus Act and the Insurrection Act.

TRUMP VOWS TO MOBILIZE FEDERAL RESOURCES IN ADDRESS TO NATION, MAKES SURPRISE TRIP TO CHURCH THAT CAUGHT FIRE

The Posse Comitatus Act generally forbids Army or Air Force involvement in domestic law enforcement.

“Whoever, except in cases and under circumstances expressly authorized by the Constitution or Act of Congress, willfully uses any part of the Army or Air Force as a posse comitatus or otherwise to execute the laws shall be fined under this title or imprisoned not more than two years, or both,” the law says.

The statute only applies to the Army and Air Force, but 10 USC 275 calls for the Secretary of Defense to “prescribe such regulations as may be necessary to ensure that any activity (including the provision of any equipment or facility or the assignment or detail of any personnel) under this chapter does not include or permit direct participation by a member of the Army, Navy, Air Force, or Marine Corps in a search, seizure, arrest, or other similar activity unless participation in such activity by such member is otherwise authorized by law.”

These laws do not prohibit the use of the U.S. Coast Guard or National Guard.

TRUMP UNLOADS ON GOVERNORS OVER PROTEST RESPONSE, CALLS THEM 'WEAK' 

Yet the prohibitions against using the military for domestic law enforcement have several exceptions. If President Trump were to call on them to help quell riots, he would likely do so under the Insurrection Act, which allows the president to call on the U.S. armed forces to assist in law enforcement in certain circumstances.

Those situations include “any insurrection, domestic violence, unlawful combination, or conspiracy” that “hinders the execution of the laws of that State, and of the United States within the State,” specifically where “any part or class of its people is deprived of a right, privilege, immunity, or protection named in the Constitution and secured by law,” and the state’s own authorities “are unable, fail, or refuse to protect that right, privilege, or immunity, or to give that protection.”

The president can also use armed forces in the event of violence or an insurrection that “opposes or obstructs the execution of the laws of the United States or impedes the course of justice under those laws,” or if a state calls on the president to help quell an insurrection against the state’s government.

During his remarks Monday evening, Trump specifically said that use of the military would either be at the request of states to have the National Guard deployed, or in the event that cities or states refuse to take measures to protect their residents.

CLICK HERE TO GET THE FOX NEWS APP

“If a city or a state refuses to take the actions that are necessary to defend the life and property of their residents, then I will deploy the United States military and quickly solve the problem for them,” Trump said.

Other exceptions to the Posse Comitatus Act are statutes that allow for the U.S. Department of Defense to assist in counterdrug and counter-transnational organized crime operations, cases involving nuclear materials, and where the secretary of defense and attorney general agree that there is an emergency situation involving weapons of mass destruction that “poses a serious threat to the interests of the United States” and is beyond the capabilities of regular law enforcement.