I was considerably more pessimistic about the impact of the War on American liberty before I read Jess Bravin’s The Terror Courts: Rough Justice at Guantanamo Bay. It’s not that the author is an optimist—far from it. Bravin, The Wall Street Journal’s Supreme Court reporter, describes with dismay how George W. Bush’s administration attempted to create a shadow justice system for dealing with those the executive branch views as perpetrators and facilitators of terror.

Wielding no partisan axe, Bravin also laments Barack Obama’s failures to renounce many of the executive powers claimed, and often exercised, by Bush.

But Bravin also describes a civil war within the national security establishment. As Bush’s most hardened hawks charged ahead in rounding up suspected terrorists, others within the government fought, both overtly and covertly, to protect constitutional procedures.

It is no secret that sectors of civil society—the civil liberties organizations, the organized bar, much of the news media—battled Bush and his henchmen (and now Obama and his henchmen) to prevent abuses of civil liberties by military tribunals. Bravin showed that they had an important set of allies in that fight. To the extent that liberty and due process have survived, they endure thanks in large measure to men and women on the inside, who rebelled against, and in subtle ways worked to undermine, what they deemed threats to the nation’s fundamental institutions.

Those military commissions, established by presidential order, were assigned to try terror suspects on the basis of evidence and procedures that would never hold up in either a court martial or a federal court. The most frequent and dramatic problems arose when the president’s men were determined to use the fruits of coercive interrogation techniques—torture, in the eyes of many within the military justice system—as evidence in a tribunal.

Yet the commissions never did become kangaroo courts. You can give part of the credit for that to the unexpectedly assertive federal courts, and part to an occasionally assertive Congress. But Bravin shows, in fascinating and often dramatic detail, how members of the security agencies and the military pushed back against the changes, effectively thwarting the president’s men. Officers on the ground turned out to have minds and principles of their own, and those principles frequently conformed more precisely to constitutional values than those of their superiors.

For example, Navy Lt. Commander Charles Swift, the lawyer appointed by the Pentagon to try to wrest a guilty plea from captive Salim Hamdan, ignored his marching orders and instead advised his client to fight rather than engage in a plea bargain. The ultimate result was the Supreme Court opinion in Hamdan vs. Rumsfeld (2006), which imposed legal constraints on the Bush administration’s program for trying alleged terrorists by military commission.

Thanks to Lt. Commander Swift and the Supreme Court, Hamdan, who had been Osama bin Laden’s chauffeur, received a fair trial. The government charged him with terrorist conspiracy and with providing material support to terrorists, essentially attempting to hold Hamdan responsible for the actions of his employer.

Because of the absence of evidence that Hamdan did much of anything other than drive the boss around, the prosecution tried to fill in the gaps by calling an expert witness, Evan Kohlmann. For the munificent sum of $25,000, Kohlmann lectured the military jury on the horrors of the Al Qaeda terror network. Both civilian and military prosecutors frequently call on Kohlmann, whose credentials are scant, to frighten jurors with his vivid narratives. (Disclosure: Kohlmann brought his dog-and-pony show to a trial in federal district court in which I served on the defense team.)

The military jury proved itself immune to these scare tactics and to the government’s overwrought theories of culpability. It acquitted Hamdan on the conspiracy count. It convicted him on the charge of material assistance, but instead of the life sentence the prosecution hoped for, it gave him five months and eight days after crediting time served awaiting trial.

(This past October, after the cut-off date of Bravin’s narrative, the U.S. Court of Appeals in Washington overturned even that conviction, holding that the international law of war did not deem “material support for terrorism” to be a war crime.)

Bravin penetrated a system designed for railroading prisoners in near-total secrecy, and he demonstrated the persistence of many ordinary—and some extraordinary—Americans’ visceral devotion to such quaint notions as the presumption of innocence and the rule of law.

Harvey Silverglate, a Boston-based criminal defense and civil liberties lawyer, is the author of Three Felonies a Day: How the Feds Target the Innocent.