Garrett M. Graff is the editor of Washingtonian magazine and author of “The Threat Matrix: The FBI at War.”

While President Obama garnered headlines last week for his speech about reining in extralegal drone strikes and restarting efforts to close the prison at Guantanamo Bay, his plan to nominate James Comeyas the next director of the FBI is an equally important statement about his intentions in the fight against terrorism.

In 12 years under Director Robert Mueller, the FBI has evolved from a domestic law enforcement agency focused on bank robbers and kidnappers to an international intelligence agency with agents posted in more than 60 countries. Comey’s record suggests that he could bring order to the sprawling FBI national security programs and processes started after the Sept. 11, 2001, attacks, narrowing their focus to only the greatest threats and ensuring a strong legal footing and constitutional boundaries. As his onetime mentor, Attorney General Eric Holder, battles allegations of investigative overreach, Comey might be the antidote the Justice Department needs to restore its moral compass.

For Comey, fighting crime has been a personal crusade. As a child, he was held hostage at gunpoint, along with his brother and three neighbors, by a man who broke into his parents’ New Jersey home. In the 1980s, he led “Project Exile,” a cutting-edge program in crime-ridden Richmond that federalized local gun-crime prosecutions and delivered tough sentences for those convicted of weapons charges. Comey is an accomplished career public servant who helped prosecute the Gambino crime family, Martha Stewart and those who bombed the Khobar Towers in Saudi Arabia in 1996.

Yet the most telling point of his public service career came out of the spotlight. In 2004, as the newly appointed deputy attorney general under John Ashcroft, he led the push to bring a terrorist surveillance program — known by its code names Stellar Wind and Ragtime — within constitutional boundaries. Almost single-handedly, he faced down Vice President Dick Cheney and Cheney’s lawyer David Addington in a series of meetings at the White House. Comey refused to sign authorizations for the program to continue unless changes were made.

The week-long drama culminated in a late-night showdown at the bedside of Ashcroft, who was hospitalized with pancreatitis. Then-White House Counsel Alberto Gonzales and Chief of Staff Andrew Card tried to get Ashcroft to sign the authorization Comey wouldn’t. That evening, Comey, Mueller and other Justice officials prepared for a mass resignation that would have upended the 2004 presidential race and echoed Richard Nixon’s “Saturday Night Massacre.” The letter of resignation Comey drafted that night read in part, “I and the Department of Justice have been asked to be part of something that is fundamentally wrong.”

The next day, the president blinked. Comey’s objections were heard and the program was amended.

A year later, Comey went to Fort Meade to address National Security Agency staff. The speech, little noticed at the time, explained at length his actions of the year before — steps that had brought him into direct conflict with the NSA staff.

“It can be very, very hard to be a conscientious attorney working in the intelligence community,” he said. “Hard because we are likely to hear the words, ‘If we don’t do this, people will die.’ You can all supply your own ‘this.’ ‘If we don’t collect this type of information,’ or ‘If we don’t use this technique,’ or ‘If we don’t extend this authority.’ It is extraordinarily difficult to be the attorney standing in front of the freight train.”

Comey argued that officials must see the broader picture: The United States is a nation of laws. All government officials take the same oath, he said, promising allegiance not to the president, the party in power or even the American people — but to protect and defend the Constitution.

“We know that our actions, and those of the agencies we support, will be held up in a quiet, dignified, well-lit room, where they can be viewed with the perfect, and brutally unfair, vision of hindsight. We know they will be reviewed in hearing rooms or courtrooms where it is impossible to capture even a piece of the urgency and exigency felt during a crisis,” he said. “ ‘No’ must be spoken into a storm of crisis, with loud voices all around, with lives hanging in the balance. . . . It takes an understanding that, in the long run, intelligence under the law is the only sustainable intelligence in this country.”

It would have been easy for Comey to reauthorize the domestic surveillance program. Instead, he held firm in a “storm of crisis.” It’s that strong moral compass that the president apparently wants to lead the nation’s chief domestic law enforcement agency. That Obama would seek out someone who has so jealously guarded civil liberties, even at great personal and career risk, speaks more loudly than his speech about the legacy he wants to leave in the fight against terrorism.

Ann Telnaes animation: Eric Holder’s strange remorse. (Ann Telnaes/The Washington Post)