(Richard Mia)

Once again, Richard Leon isn’t buying what the government has been trying to sell him in the war on terror.

In December, the U.S. district court judge in Washington, D.C., made headlines when he was the first federal judge to hold that the National Security Agency’s telephonic data surveillance program was likely unconstitutional. The decision made Leon, a George W. Bush appointee, a hero to progressives and libertarians alike and earned him praise from the likes of fugitive NSA leaker Edward Snowden and senators such as Ted Cruz and Rand Paul, and criticized by intelligence hawks such as Democratic Sen. Dianne Feinstein, the chair of the Senate Intelligence Committee, and Michael Mukasey, the former Bush attorney general. It also placed more pressure on the White House to dramatically scale back the program, something the president has so far resisted.

Leon has struck at the heart of the government counterterrorism rationale before: Five years ago, he was the first judge to order a bevy of detainees released from the prison at Guantánamo Bay. Then, as now, he simply wasn’t prepared to take the government’s word—no matter which party held the White House.

In 2008 Leon held in a habeas corpus proceeding that the Bush administration couldn’t justify holding five Algerian men at Guantánamo. In the NSA case, he found that the Obama administration couldn’t show that the surveillance program, which collects billions of telephone numbers but not the substance of the calls, was essential to repelling security threats. Then, as in now, “it would have been very easy for him to err on the side of national security,” his longtime friend, D.C. attorney David Laufman, says.

Leon’s NSA opinion drew inspiration both from a federalist, James Madison, and a committed socialist, George Orwell—and tapped into the widespread unease over the agency’s collection of bulk data. “James Madison, who cautioned us to beware ‘the abridgment of freedom of the people by gradual and silent encroachments by those in power,’ would be aghast,” Leon wrote. Unless checked, the NSA program could go on as long as the nation combats terrorism, which,” he said, “realistically could be forever.”

Leon went even further. In a move that critics might deride as judicial activism, the judge disregarded what other experts saw as controlling precedent, a 1979 Supreme Court decision that held that telephone calling records aren’t protected by the Fourth Amendment. Instead, Leon concluded that Americans today have an “entirely different” relationship with their phones than they did 35 years ago because of the central role they have taken in consumers’ lives, and called current monitoring technology “the stuff of science fiction.”

Other judges weren’t so quick to agree. U.S. District Judge William Pauley in Manhattan, an appointee of President Bill Clinton, soon upheld the NSA program on the grounds of the 1979 precedent. The Foreign Intelligence Surveillance Court in Washington has also held the program to be legal in an unclassified decision released last year. The matter is likely to end up before the Supreme Court, and Leon could well find himself on the losing end.

Being reversed likely won’t matter. As a judge, Leon seems to take a particular delight in poking the federal beast with a stick. “I don’t think anything intimidates him,” says Jim Leach, a former Iowa congressman who worked with Leon when he was a Republican counsel in the House of Representatives. The NSA ruling was no surprise to Stephen Oleskey of Boston’s Hiscock & Barclay, who represented the five Algerians in Guantánamo: “It was consistent with the man I saw try and decide our case,” he says. Oleskey vividly recalls Leon five years ago departing from his written order to urge the U.S. Department of Justice not to appeal, saying that they had been held long enough. The government stood down. (Leon found a sixth man to be properly detained as an agent of al-Qaida.)

Leon was personally concerned about the plight of the prisoners, Oleskey says. “He didn’t want to prolong that case,” he says. “He didn’t want to prolong the suffering of these men.”

What makes decisions like these more notable is that if any member of the federal bench appeared to have come pre-equipped to toe the government line, it was Leon. Nominated by Bush the day before 9/11, Leon is, those who know him say, an undeniable conservative, one who attends Federalist Society mixers. He was a Republican House counsel during congressional probes into both the Iran-Contra scandal and the so-called October Surprise—allegations that Ronald Reagan’s presidential campaign secretly negotiated for the release of American hostages in Iran. And when Leach served as the top Republican on the House Financial Services Committee, Leon spearheaded the inquiry into Madison Guaranty Savings and Loan Association, the failed financial institution that was the leading edge of what became known as Whitewater.

Leon’s conservative philosophy, however, appears to take the form of a deep skepticism of governmental overreach. He recently ruled against the U.S. Food and Drug Administration in two major suits, holding that the agency couldn’t regulate e-cig­arettes and couldn’t force cigarette makers to place gruesome warning labels on packages. (In the former case, he inveighed against what he termed the FDA’s “tenacious drive to maximize its regulatory power.”) Last year, he ruled against the Federal Reserve in a closely watched case over so-called swipe fees for debit card transactions, holding that banks improperly capped the amount that merchants can collect on each transaction.

And even when Leon was enmeshed in some of Washington’s most contentious episodes, he demonstrated he could never be cast as a conservative caricature. In the October Surprise investigation, Leon entered into a widely praised partnership with the Democratic counsel, the late D.C. white-collar lawyer E. Lawrence Barcella, to investigate and debunk the conspiracy theory. And in Whitewater, Leach says, Leon exhibited his temperate side: Although some Republicans wanted to see then–First Lady Hillary Clinton testify, the committee opted not to call her, in order to demonstrate that the probe had limits.

Leon has a strict rule about not speaking to the media, but his friends describe him as a loyal and gregarious man who dotes on his college-age son and, in Laufman’s words, “doesn’t make enough time for life outside the bench.” For his part, Oleskey, a longtime progressive, ended up feeling some kinship with Leon, despite their opposing worldviews. Both hail from Massachusetts, and Oleskey not long ago attended a talk that Leon gave at Boston’s Suffolk Law School, Leon’s alma mater.

Leon, he said, told the audience, “You shouldn’t make assumptions on what judges will do based on their past politics.”

James Oliphant is a Washington, D.C.–based journalist who writes about the intersection of law and politics.