Migrants with children stand in the back of a parked truck, in hopes that the driver will give them a ride, as Central Americans hoping to reach the U.S. border move onward from Juchitan, Oaxaca state, Mexico, on Thursday. (Rebecca Blackwell/AP)

Harry Litman teaches constitutional law at the University of California at San Diego and practices law at the firm Constantine Cannon. He was U.S. attorney for the Western District of Pennsylvania from 1998 to 2001 and deputy assistant attorney general at the Justice Department from 1993 to 1998.

President Trump’s decision to send thousands of military personnel to the southern border to help turn back a group of 3,500 migrants violates a deep principle of Anglo-American law.

The principle is the prohibition of military involvement in domestic law enforcement. Its abridgement was prominent among the charges laid on King George in the Declaration of Independence — Jefferson wrote that the crown “has affected to render the Military independent of and superior to the Civil power.” And its common law roots are far stronger and older, dating at least to Magna Carta.

The legal provision that encapsulates the principle is the Posse Comitatus Act. The law was passed in 1878, following widespread, heavy-handed use of Union troops to exercise typical law enforcement functions in the former Confederate states. In its current form, it provides criminal penalties for anyone who “willfully uses any part of the Army or Air Force as a posse comitatus” — that is, as an auxiliary of law enforcement — “or otherwise to execute the laws.” There is an exception for circumstances expressly authorized by the Constitution or an act of Congress, which Congress invoked for example in authorizing limited military involvement in the war on drugs.

Its obscure name and rare deployment notwithstanding, the Posse Comitatus Act enshrines the bedrock democratic idea that civil society is separate from and superior to military force, and that regulation of citizens by military is antithetical to liberty.

Civil law enforcement is governed by constitutional protections and accountability to the court. Military force is governed by the law of war and the imperative of national defense against other militaries. They serve critically different functions, practically and morally; and they ought not overlap.

Operation Faithful Patriot, Trump’s election-season deployment of massive military force to the southern border, presents a classic illustration of the improper use of the military in a democratic society. The president sent 800 a week ago, this week increased the intended troop numbers to 5,200, and then upped the ante, promising the numbers will swell further to up to 15,000 troops, roughly equivalent to the U.S. presence in Afghanistan.

This is both unnecessary and unwise. First, the purported need for an immediate, massive military force to supplement regular law enforcement is, to put it mildly, silly. Trump has tweeted as if this were the Alamo: “Our military is being mobilized at the Southern Border. Many more troops coming. We will NOT let these Caravans, which are also made up of some very bad thugs and gang members, into the U.S.”

In fact, this deadly threat to our sovereignty and border security consists of an exhausted, pitiful group of desperately poor migrants, including many children, fleeing poverty and violence in Central America. They are a humanitarian crisis, not an invading army.

Second, the military has no skill at processing immigrants, no training in legal requirements such as probable cause and scant knowledge of the humanitarian demands of incoming migrants that are all second nature to Border Patrol. In fact, the Army’s presence will put at greater risk the goal of arresting and charging members of the caravan who are attempting to enter the United States illegally.

The Posse Comitatus Act’s criminal provisions are honored in the breach: No one has ever been prosecuted for violating this law. But the courts have at times scuttled prosecutions for running afoul of the act. In the aftermath of the Army’s massacre of Native Americans at Wounded Knee, for example, two courts held that the violation of the act meant that the government could not show that the military personnel were “lawfully engaged in the lawful performance of their official duties,” which was one of the elements of the criminal charges against persons who gave help and support to the Native American occupants during the siege.

The Trump administration’s strategy for avoiding violations of the Posse Comitatus Act is to instruct that the Army provide only logistical support to Border Patrol agents, a use of military personnel that has been upheld by the courts. As Defense Secretary Jim Mattis told reporters Wednesday morning, the operation is merely “practical support based on the request from the commissioner of customs and border police.”

I had a role in analyzing that issue in the Oklahoma City bombing prosecution, concluding that the Justice Department could use Army personnel to search the desert where Timothy McVeigh was thought to have left a duffel bag. There was a special justification there, because the desert terrain, and the possibility of mines, called for the distinctive skill and training of members of particular units of the armed forces.

If the military’s presence remains strictly limited in this way, it likely passes legal muster. But it then raises the question of for what possible reason Border Patrol needs up to 15,000 soldiers to put up tents and drive its officers around. And the answer seems pretty clear: It doesn’t, certainly not to confront a hopeless assembly of ragtag migrants. The troops rather are being deployed in the service of a political talking point for Trump to use to rally the base in the last week of the campaign.

And the raucous enthusiasm of the response indicates that is exactly what Operation Faithful Patriot is achieving. The true faithful patriots Trump has in mind are, as always, the 40 percent or so of zealous supporters who gave him his knife’s-edge victory and for whom alone he has governed. They in turn give back to him, feeding his own distorted self-image of an adored, great commander in chief. Trump’s idea of making America great again is conjuring up a phony crisis for him to solve with swashbuckling strongman force. If the facts and the law have to give way to make room for this shared political fantasy, so be it.