In this polarizing election season, law enforcement and intelligence groups have been warning that violence or unrest poses a threat to today’s election.

Those warnings have raised a once unfathomable question: Could the military be called on to quell election-related violence in America’s streets?

Three states, along with Washington, D.C., have announced they are putting National Guard units on standby. So the short answer is yes. The slightly longer answer is yes, with a lot of “it depends.” Q >> Who can deploy the military?

A >> The military cannot just “step in” on Election Day or any other day. Any decision to deploy troops domestically needs to come from a legal or constitutional authority.That’s typically the president or, in the case of the National Guard, a state governor.

Q >> What’s the difference between deploying the National Guard and active-duty troops?

A >> Most of the time, the National Guard is under the command of a state governor, who can use Guardsmen for any number of missions in their state. State governors can also lend their National Guard units to other states that request them. For instance, 14 states have sent Guard units to the southern border at Texas Gov. Greg Abbott’s request.

But the president can also federalize National Guard troops, or bring them under presidential control. In that case, they are subject to certain additional safeguards to ensure we don’t use the military as a domestic police force.

Q >> What are those safeguards?

A >> The big one is called the Posse Comitatus Act, which prevents the military from acting in a law enforcement capacity. Under normal circumstances, the military—including National Guard troops under presidential control—can’t start searching or arresting protestors if there were demonstrations after the election or on Inauguration Day.

Q >> Are there other limits on what the military could do specifically on Election Day?

A >> U.S. law expressly forbids “troops or armed men” at polling places. It also forbids members of the military from preventing or trying to prevent citizens from voting. The Defense Department doubles down on this in its internal policy, stating clearly that soldiers and federalized Guardsmen “will not conduct operations at polling places.”

It makes sense that federal troops should not be mixed up in the electoral process, says Lindsay Cohn, a security professor at the Naval War College.

“The federal government is not in charge of elections,” she said. “Elections are run by the states.”

Q >> Are there any exceptions to the rule?

A >> There’s one. The law allows for the presence of military troops at a voting site to “repel armed enemies of the United States.”

It’s not entirely clear what might constitute an “enemy” at a polling place, says Claire Finkelstein, director of the Center for Ethics and the Rule of Law at the University of Pennsylvania. “Presidents have traditionally had the authority to decide who is an enemy of the United States.”

It’s also important to note that the prohibition only applies to federal troops — not the National Guard, if it’s under the command of a state governor.

Q >> So, National Guard units under state control could be called up on Election Day?

A >> That’s right. The governors of Nevada, Washington and Oregon have all ordered National Guard units to stand by election week.

Some states have laws that forbid military or law enforcement officers from being present at election sites. But in many states, the National Guard is used to provide election security.

Q >> Is there anything the National Guard can’t do around the election?

A >> Governors have a lot of leeway in mobilizing their National Guards. But the decision to activate Guard units domestically typically comes only after in-depth planning discussions between National Guard and state leadership, says Major Gen. Daryl Bohac, who served as Nebraska’s adjutant general for 10 years.

National Guard troops deployed under the command of their governor are not subject to the federal Posse Comitatus Act, meaning they can directly assist civilian law enforcement with police activities.

“Public trust is so important to the military and its ability to operate no matter where we are, whether it’s in the states or abroad,” Bohac says.

Q >> Are there any other exceptions to the Posse Comitatus Act?

A >> Yes, but most of them don’t come into play around the election or the transfer of presidential power—except for one: the Insurrection Act. It’s a set of laws dating back to the earliest days of our country that give the president broad authority to mobilize the military to suppress a rebellion or other unrest that “make it impracticable to enforce the laws of the United States.”

Q >> Can troops do anything under the Insurrection Act?

A >> No. Invoking the Insurrection Act does not suspend the Constitution or other protections.

But the Insurrection Act effectively leaves it up to the president to unilaterally determine what might constitute a rebellion.

Q >> When is the last time a president invoked the Insurrection Act?

A >> We’re actually in the longest period in which the Insurrection Act hasn’t been invoked. The last time a president invoked the Insurrection Act was during the 1992 Rodney King riots in Los Angeles.

When former President Donald Trump has talked about deploying the military against civilian protestors, legal experts believe the justification would likely come from the Insurrection Act.

Even if Trump wins the election, the president-elect cannot invoke the Insurrection Act or deploy the military. That wouldn’t come until Jan. 20, just after noon on Inauguration Day.