In the pre-dawn darkness of December 11, 1917, thirteen American soldiers died together at the same moment, hanged in a mass execution on gallows that were immediately torn back down to lumber so other soldiers wouldn't see them. If you serve in the military today, your life is better because of that morning, and because of the debate that followed. Samuel Ansell left the Army nearly a hundred years ago, and he might save your life one day.

The men who died on December 11 were black privates and NCOs, infantrymen who served together under white officers in the segregated 24th Infantry Regiment. Earlier that year, in the spring of 1917, they had been sent to Texas to guard army facilities as the United States went to war in Europe. Posted outside Houston, the men of the 24th collided with Jim Crow laws and the social customs that went with them. By mid-August, arguments were nearly turning into fights, and a white laborer on Camp Logan stabbed a black civilian to death in the payroll line.

On August 23, two Houston police officers saw a group of black teenagers shooting craps on a city street, and tried to arrest them for illegal gambling. The teenagers ran, and the police chased them, bursting into homes in an African-American neighborhood. A black woman named Sara Travers complained, and a pair of white policemen dragged her outside, half-dressed, to arrest her. Watching white police rough up a black woman, a soldier from the 3/24 in the city on a pass stepped forward and told them to stop. They beat him and took him to jail. Soon after, an NCO from the 2/24 approached the officers and demanded an explanation for the beating and the arrest. At that point, Officer Lee Sparks pulled his revolver out and began to beat Cpl. Charlies Baltimore over the head with it – then fired at his back as he ran away, before catching up to him and hauling him away to jail, too.

It was the moment when the arguments ended and the fighting began. Back at Camp Logan, a group of about 100 soldiers stormed an ammunition tent, loaded rifles, and went into town to find the police officers who had beaten and shot at their fellow infantrymen. They found them. At the end of a running gun battle, nineteen people were dead: Fifteen of them white, including police officers, and four black soldiers.

The courts-martial that followed were a joke, mass trials meant to placate infuriated Texas politicians. Sixty-three men were tried before the first of three courts, with single witnesses casually implicating dozens of defendants and men being convicted on the strength of testimony that had flatly misidentified them in court. For their defense, they were represented by an infantry officer with no legal training. On November 29, returning guilty verdicts by the box lot, the court sentenced 13 defendants to death. Facing local pressure, the convening authority, Maj. Gen. John Rickman, approved the verdicts and scheduled the executions – on his own authority, without seeking approval from the Army or the War Department.

The 13 men were simultaneously hanged on December 11 at 7:17 a.m. local time -- one minute before sunrise -- in the presence of U.S. Army officers and one local official, County Sheriff John Tobin.

It was the event that kicked off the debate about military justice during World War I: American soldiers were being killed by their own army without any kind of legal review or approval by national authorities.

Incredibly, the War Department issued a general order forbidding local commanders to put soldiers to death before the Judge Advocate General and the president had a chance to review their convictions – an obvious expectation that was only imposed for the first time in the second decade of the 20th century. Imagine serving in an army that could put you in front of the firing squad or put a noose around your neck a few days after a shoddy trial, with no one checking to make sure you hadn't just been railroaded. That was a possible feature of military experience for the first century and a half of our history.

The War Department order was just in time. While the court-martial in Texas was delivering its sentences, drumhead courts-martial at the front in France were sentencing four other privates to death. Jeff Cook and Forest Sebastian had fallen asleep on guard duty on the front line, slumped forward against the trenches, while Olon Ledoyen and Stanley Fishback refused an order to drill. All four had even less of a trial than the soldiers of the 24th Infantry. Ledoyen and Fishback were represented in their defense by an infantry lieutenant who was pulled from the line for the job. Shrugging, he told them both to just plead guilty and hope for the best. All four trials took somewhere in the neighborhood of a few minutes, with little to no testimony, argument, or deliberation.

This is where our contemporary military justice system was born. In Washington, the Army had two top legal officers. The Judge Advocate General, Maj. Gen. Enoch Crowder, was temporarily assigned to other wartime duties, so Brig. Gen. Samuel Ansell was the acting JAG; both thought of themselves as the Army's top legal officer. The two men had completely different reactions to the trials in Texas and France, and a totally different view of the way courts-martial were supposed to work. Their argument – the "Ansell-Crowder dispute" – kicked off a full century of debate.

To Crowder, the purpose of a court-martial was discipline and good military order, and the results of a trial could only merit objections from army lawyers if blatant unfairness screamed from the record of the proceedings. Commanders needed near-absolute latitude to deliver the punishments inflicted by courts, and the JAG office had little to no reason to interfere. If the army's lawyers objected to the death sentences in France, Crowder warned, Pershing would believe that his authority had been undermined in a critical matter involving his command.

But to Ansell, courts-martial had to be courts. They needed standards of evidence and reasonable rules about due process, and the outcome of a military trial could become illegitimate when courts broke rules. The acting JAG and the circle of reformers around him tore into the records of the courts-martial in France – finding, for example, that Cook and Sebastian had gone four days with almost no sleep at all, but their courts-martial had taken no notice of those extenuating circumstances in delivering death sentences. "These cases were not well tried," Ansell wrote.

President Woodrow Wilson agreed with Ansell and pardoned all four men. Sebastian died in combat soon afterward, fighting with courage, and Wilson told War Department officials that he was glad to have given a soldier a chance to redeem himself.

Then the war ended, and the argument got serious. Ansell presented a long report to Congress, detailing a series of proposals for changes in the Articles of War, the pre-UCMJ law that governed the army. He especially wanted to see the law adopt some form of mandatory post-conviction legal review, creating an appellate authority that had the direct power to overturn bad convictions. But Crowder eased him out of the office, arranging a job for Ansell at a law firm before telling him that he was done in the army. As Congress prepared to vote on Ansell's proposed reforms, Crowder – back at his regular duties as the army JAG – gave his congressional allies a set of more modest changes. In an amendment to the pending legislation, they swapped out Ansell's reforms for Crowder's, and the law passed.

Even as Crowder won, though, Ansell had forced a more serious set of reforms on the army than his adversaries had wanted to see. Among the changes to the laws governing the army in 1920, Congress created boards of review for the first time. A retired JAG officer, Lawrence J. Morris, calls those boards "the first step toward a formal appellate process." Another change required courts-martial to reach unanimous agreement to impose the death penalty, where the previous Articles of War had only required a two-thirds majority vote to put a soldier to death.

Ansell began the long effort to make courts-martial into true courts, giving soldiers some degree of due process protection. And he planted the seeds for all of the debates that have followed. After World War II, when Congress and the newly created Department of Defense decided to pursue the more serious reforms that led to the creation of the Uniform Code of Military Justice, the person who led the effort was a law school professor, Edmund Morgan – who had spent World War I in uniform, working for Ansell in the office of the Judge Advocate General.

Injustice led to justice. Your legal rights before the military justice system today – including your right to a trial that isn't tainted by unlawful command influence, your right to be represented by a lawyer, and your right to appeal serious convictions to real military appellate courts – were born in a field outside Houston in 1917. Arguing over the death of soldiers, Samuel Ansell and the generation of army lawyers who served alongside him began to make military justice a far better system for everyone who followed. They were patriots who served their country with honor and left it a better place.

Chris Bray is the author of "Court-Martial: How Military Justice Has Shaped America from the Revolution to 9/11 and Beyond," published last month by W.W. Norton.