WASHINGTON — During one of the searing moments that Robert S. Mueller III proved his willingness to stand up to the power of a president, he had his friend, James B. Comey, by his side.
It was 2004 and Mr. Mueller, then the F.B.I. director, and Mr. Comey, the deputy attorney general, together blocked efforts by President George W. Bush to reauthorize a secret government surveillance program.
After racing to a Washington hospital room, Mr. Mueller and Mr. Comey prevented top Bush aides from persuading a severely ill attorney general to reauthorize the surveillance program over their objections. The scene — and their later threats to resign — became the stuff of legends at the Justice Department and the F.B.I., cementing their reputations for independence.
The podcast that makes sense of the most delirious stretch of the 2016 campaign.
Now, Mr. Mueller, retired after 13 years at the bureau’s helm under Mr. Bush and former President Barack Obama, will oversee a sprawling investigation into Russia’s interference in the 2016 election — and any collusion between President Trump’s campaign and Moscow. The inquiry will include Mr. Trump’s interactions with, and abrupt firing of, the man who until last week had been leading the investigation: Mr. Comey.
Mr. Mueller’s role as special counsel also will put him in charge of pursuing the truth about the president’s efforts, if any, to impede the F.B.I.’s investigation.
Veteran law enforcement officials praised the selection on Wednesday, calling Mr. Mueller someone widely respected by members of both parties as an unflinching advocate for facts.
“Best possible selection they could have made. Truly independent, nonpartisan and certainly knows how to investigate,” said Timothy Murphy, who retired as F.B.I. deputy director in 2011. “No one stands as tall.”
Mr. Mueller, 72, was born in New York and attended Princeton University before earning a master’s degree in international relations from New York University. He led a rifle platoon in Vietnam before receiving a law degree from the University of Virginia and becoming a federal prosecutor in San Francisco and Boston. He supervised cases like the prosecution of the crime boss John J. Gotti and the investigation into the bombing of Pan Am Flight 103 over Scotland.
The picture of an old-fashioned G-man, Mr. Mueller, a onetime ice hockey player, rose through the F.B.I.’s ranks to become director just a week before the Sept. 11, 2001, attacks, which forced him to transform the bureau from a crime-fighting organization into a central piece of the antiterrorism establishment.
In doing so, he sought to avoid the chopping up of the bureau by embracing a new mission even as he repeatedly refused to abandon his law-enforcement roots. Just days after the attacks, he clashed with other Bush administration officials whom he viewed as too willing to abandon prosecutorial protections and procedures.
Even so, Mr. Mueller survived the bureaucratic and political maelstrom in Washington, serving out his 10-year term before Mr. Obama asked him to stay on for three more years. That required an act of Congress, which was approved in 2011.
Mr. Mueller nurtured bipartisan support throughout his career by carefully cultivating an above-the-fray posture, often trying to stay out of politically charged disputes.
“Smart, tough and persistent but fair,” Fran Townsend, Mr. Bush’s Homeland Security adviser, said on Wednesday. Senator Chuck Schumer of New York, the Democratic leader, said he now has “significantly greater confidence that the investigation will follow the facts.”
An intensely private figure who has largely vanished from public view since his retirement, Mr. Mueller has often pined for the days when he worked to prevent run-of-the-mill crimes.
In a speech just before terrorists bombed the Boston Marathon, Mr. Mueller said, “I love doing bank robberies, drug cases, homicides — as a prosecutor, that’s what I thought I was going to be overseeing when I got to the bureau.”
Now, after a career that traveled from those kinds of traditional criminal cases to international terrorism, Mr. Mueller will investigate a president and his aides.
The appointment is certain to soothe nerves at the F.B.I., where agents have felt under siege by Mr. Trump’s abrupt firing of Mr. Comey and his repeated criticism of their investigation into Russian interference in the election.
Analysts and agents who have briefed Mr. Mueller tell some variation of the same story to show how exacting and relentlessly detail-oriented he is. The story involves a surveillance operation, with agents tailing a suspect in a car. Mr. Mueller is known to ask all the predictable questions about the suspect, and then pounce with “What color is the car?”
In some tellings, the briefer responds, “Red,” only to be asked, “What shade?”