Judge Brett Kavanaugh’s judicial record on the Guantanamo military commissions is richer and less one-sided than some analysts, including Steve Vladeck in the Washington Post, have suggested. But in a case those analysts failed to mention—Hamdan v. United States (2012), commonly called Hamdan II— Kavanaugh displayed a willingness to hold the government’s feet to the fire in a case involving an unpopular defendant. Moreover, the record shows that Kavanaugh’s commitment to apply the law “as written” is informed by history and context. Those qualities are joined with another view rightly tagged by analysts and openly acknowledged by Kavanaugh himself: a determination to keep international law “in its lane” and to make that lane quite narrow unless U.S. law clearly provides to the contrary.

Kavanaugh applied the law in a principled fashion to limit the government’s power to try certain Guantanamo detainees—a group widely shunned as the “worst of the worst” (to quote Donald Rumsfeld). Consider the case of Salim Hamdan, Osama bin Laden’s driver and bodyguard. The Supreme Court used Hamdan’s case to declare in a landmark 2006 ruling that President George W. Bush’s order establishing military commissions at Guantanamo violated the separation of powers because it clashed with governing legislation. After Congress fixed this problem with the Military Commissions Act of 2006 (MCA), the government in 2008 tried Hamdan under the new statute’s provisions, in a military commission that heard much testimony and received copious documentary evidence. The evidence that Hamdan marshaled at trial included evidence that he had not been in bin Laden’s inner operational circle, despite his physical proximity to the al-Qaeda leader.

The commission acquitted Hamdan of the most serious charges and convicted him on a minor count of material support of terrorism. That count did not allege that Hamdan had assisted in any specific act of terrorism, such as the willful targeting of civilians; it simply alleged that Hamdan had provided ministerial support, including transporting generic supplies and driving bin Laden to various meetings with other al-Qaeda figures. The sentence, including Hamdan’s time served in detention, resulted in Hamdan’s release in early 2009.

In 2012, the D.C. Circuit, in an opinion by Kavanaugh, vacated Hamdan’s conviction. Kavanaugh’s opinion applied the “law as written.” In Hamdan’s case, that law included both the MCA and the Constitution’s Ex Post Facto Clause. The Ex Post Facto Clause is a pillar of the original Constitution’s architecture of liberty. Put simply, the Ex Post Facto Clause bars criminal punishment for conduct that occurred before any law made that conduct illegal. That protection, also enshrined in international law as the “principle of legality,” is fundamental to the fairness of any legal system: It requires due notice to individuals that a given act can led to criminal punishment and prevents the government from using the onerous machinery of the criminal law to change the rules in the middle of the game. Thanks to the Ex Post Facto Clause, the government cannot subject unsuspecting individuals whom it doesn’t like to criminal law’s severe sanctions and penalties, which can include fines, imprisonment, and even death.

In Hamdan’s case, reading the MCA against the backdrop of the Ex Post Facto Clause indicated the infirmity of Hamdan’s material support conviction. The MCA authorized military commission trials of a range of charges, including material support of terrorism, a charge added to the U.S. penal code in the 1990s to expand deterrence of terrorist acts and organizations. (See Bobby Chesney’s piece here; the Supreme Court upheld the material support law against a First Amendment challenge in 2010.) However, there’s a catch: As noted above, Congress enacted the MCA in 2006, well after Hamdan’s charged conduct, which ended in 2001.

The statutory authority for military commissions that was operative in 2001 only permitted such tribunals to try alleged “violations of the law of war.” Under the Ex Post Facto Clause, that was the sole law that could support Hamdan’s military commission conviction. (Congress added standard criminal law provisions authorizing trial of material support charges like Hamdan’s involving conduct outside the U.S. after Hamdan’s capture—too late for charges in an ordinary civilian federal court to pass muster under the Ex Post Facto Clause in Hamdan’s case.) Kavanaugh then read the MCA to avoid constitutional problems, limiting permissible prosecutions to those consistent with the law of war as of 2001. For Kavanaugh, the mission of applying the law “as written” in Hamdan’s case entailed discerning the scope of the “law of war” as of 2001—the last date permissible under the Ex Post Facto Clause.

(In a subsequent case, Al Bahlul v. United States, Kavanaugh joined a majority of the full D.C. Circuit in holding that the Ex Post Facto Clause did not bar another detainee’s conspiracy conviction for acts “directly relate[d]” to the 9/11 attacks. Because of al Bahlul’s forfeiture of arguments not made below, that case entailed review under a more deferential “plain error” standard. The court ultimately upheld Al Bahlul’s conviction after several rounds of litigation including more than one amicus brief by me and co-counsel Jim Schoettler for law professors and former national security officials and military lawyers.)

In Hamdan’s case, Kavanaugh’s dogged research kept the government honest. Remember that the court’s key task in Hamdan’s case was establishing the content of the law of war as of 2001. To answer this question, Kavanaugh had to consider international law, since international norms embodied in customary and treaty law indisputably comprise a major part of the law of war (usually known today as the law of armed conflict or LOAC). Consulting international law in Hamdan’s case was simply part of applying the law as written by Congress. In addition, Kavanaugh consulted U.S. history and practice. Let’s leave aside for now how a court should rule if U.S. practice diverges from international law (Kavanaugh controversially stated in n. 6 of his opinion that, legislating purely prospectively so that the Ex Post Facto Clause posed no bar, Congress could expand commission jurisdiction beyond the scope of international law). In Hamdan, Kavanaugh found no divergence between international norms and U.S. practice: No evidence in custom, treaties, the history of international tribunals, or U.S. practice showed treatment of the new offense of material support as a war crime. Because no part of LOAC prohibited material support in 2001, Hamdan’s conviction could not stand. In sum, Kavanaugh’s opinion in Hamdan’s case showed that his commitment to the law “as written” was more than a handy recipe concocted to uphold the status quo or bolster government power.

To be sure, Judge Kavanagh’s Hamdan opinion is only one of several opinions by Judge Kavanaugh on Guantanamo in general, and military commissions in particular. While Steve and I differ somewhat in our analysis of the other cases, we agree that, even prospectively, military commission jurisdiction requires some nexus with international law (although I’d extend a measure of deference to Congress on how close that nexus must be). In that sense, both Steve and I also agree that Kavanaugh has been too willing to defer to the political branches. In this and other respects, Kavanaugh’s approach might differ from the approach taken by Justice Kennedy, although Kennedy often invoked deference, as in the court’s recent decision upholding President Trump’s travel ban. But in Hamdan’s case, Kavanaugh’s method ensured that the law was fairly applied to an unpopular defendant. That’s an essential part of the overall assessment of the nominee.