President Donald Trump’s pardoning of three service members convicted or accused of war crimes has been decried for eroding military discipline and tainting the country’s image. But the action also indicates that the commander in chief knows little about the U.S. armed forces or the wars they’ve been fighting.

The three pardoned are Army 1st Lt. Clint Lorance, Army Maj. Mathew Golsteyn, and Navy SEAL Chief Petty Officer Edward Gallagher. Lorance was freed after serving six years of his 19-year sentence for shooting a group of civilians in Afghanistan, then covering it up. Golsteyn was awaiting trial for allegedly murdering an unarmed Afghan civilian.

Gallagher stabbed an ISIS fighter who was undergoing surgery for a battle wound, shot two civilians from a sniper’s nest in Iraq, and threatened to kill his subordinates if they informed on him. (He was ultimately acquitted on six other charges but convicted of posing for an “unofficial photo” with a corpse.)

This is the first time a president has pardoned a service member for war crimes. Richard Nixon transferred former Army 2nd Lt. William Calley, the commander at the My Lai Massacre during the Vietnam War, from an Army brig to house arrest, but even Nixon didn’t pardon the defendant.

In October, when he announced that these cases would be reviewed, Trump tweeted, “We train our boys to be killing machines, then prosecute them when they kill!” This notion of trained “killing machines” comes from war movies—and bad ones, at that. In reality, American troops are trained as much in when not to shoot their weapons as they are in how to shoot them.

This was particularly true of the wars in Iraq and Afghanistan, where the crimes in question were committed. They were counterinsurgency wars, in which winning the “hearts and minds” of civilians was as important as killing bad guys. Killing bad guys at all was to be avoided, if possible. The U.S. Army’s counterinsurgency field manual, supervised by Gen. David Petraeus, who later commanded forces in both wars, stated: “A defection is better than a surrender, a surrender better than a capture, and a capture better than a kill.” And: “An operation that kills five insurgents is counterproductive if the collateral damage or the creation of blood feuds leads to the recruitment of 50 more.”

This principle of relative restraint created dilemmas for commanders—for instance, whether to bomb a building that housed insurgents, even if innocent civilians might be killed as well. Debates were held, sometimes in meetings involving the president, over where the line should be drawn: How many civilian deaths were permissible, given the value of killing the insurgents in question?

But these debates concerned the possibility of “collateral damage”—i.e., the accidental death of civilians. No one in these debates defended deliberate murder.

The impermissibility of deliberately or carelessly killing civilians long predates Petraeus’ field manual. It’s enshrined in the Law of Armed Conflict, an international code of warfare drafted in 1949, which was also adopted into U.S. law and the Uniform Code of Military Justice. In a phone interview, Geoffrey Corn of the South Texas College of Law describes the idea behind the law:

The international legal authority to kill and destroy is contingent on individuals operating under responsible command. The function of a commander is to prepare soldiers to navigate the moral abyss of mortal conflict, to use violence in a regulated manner in the interests of the state.

Corn said that this principle, known as “responsible command,” is “baked in everything about the Law of Armed Conflict.” It applies not only to soldiers who violate its tenets but also to those soldiers’ commanders, whether or not they were directly complicit in the crime.

Eugene Fidell, a lawyer specializing in military law and a lecturer at Yale Law School, told me that, by this standard, Trump as the commander in chief could be seen as violating the Law of Armed Conflict. “The tenet of command responsibility holds that a commander can be punished if he fails to take steps to prevent war crimes committed by his troops—or to punish them afterward,” Fidell said. By pardoning these three, Trump in a sense violated that tenet.

Certainly he sent a message that service members who commit similar acts in the future might receive the same leniency.

American service members are trained as much in when not to shoot their weapons as they are in how to shoot them.

When asked about this, Corn pointed out that under U.S. law, the president’s right to issue pardons and acts of clemency overrides his obligations as a commander under international law. However, Corn added, “In the eyes of someone in a foreign country, Trump acted inconsistently with international law and the Geneva Conventions.”

Some officers are particularly disappointed by the Golsteyn pardon because Trump took his action before the military justice system had a chance to operate. Corn, who also advised Golsteyn’s attorneys, said that trial could have answered some knotty questions about the meaning of “civilian” and whether it is illegal for a soldier to kill a member of an enemy organization away from the battlefield. It was certainly a “breach of discipline,” Corn said, but it’s not clear whether it constituted a war crime.

Trump issued the pardons against the advice of Secretary of Defense Mark Esper and several military commanders.

Andrew Exum, a former Army Ranger platoon commander and Pentagon official, tweeted after news of Trump’s pardons, “This is a sad day for the tens of thousands of us who led troops in combat in Iraq and Afghanistan who were proud of the way in which we maintained our good order and discipline in the face of many challenges. These men, now pardoned, remain a disgrace to our ranks.”

To which Petraeus, who has since retired, commented on his LinkedIn page: “I share Andrew’s sentiments and thinking.”

Retired Navy Adm. Mike Mullen, former chairman of the Joint Chiefs of Staff, told me that Trump’s action “has the potential of undermining the rule of law in the military justice system completely. We can’t take the law into our own hands in war. The idea that war has changed so much that the laws are constraining is a fallacy. War has always been a mess.”