President Obama nominated James Comey to replace Robert Mueller as FBI director on Friday. Mueller served as director for 12 years, two years longer than the standard ten-year appointment. (The Washington Post)

President Obama on Friday formally nominated Republican James B. Comey to be the next FBI director, saying the former senior Justice Department official has “law enforcement in his blood” and touting his independence and integrity.

Comey will replace Robert S. Mueller III, who is retiring after a dozen years and led the FBI through the terrorist attacks of Sept. 11, 2001, and the tumultuous national security matters that came after.

In an afternoon ceremony in the White House’s Rose Garden, Obama credited Mueller with protecting the lives of countless Americans and called him one of the most admired public servants of our time.

“Like the Marine that he’s always been, Bob never took his eyes off his mission,” Obama said. “It’s a tribute to Bob’s trademark humility that most Americans probably wouldn’t recognize him on the street, but all of us are better because of his service.”

Comey, 52, worked with Mueller at the Justice Department during the George W. Bush administration. His nomination prompted a stream of laudatory statements on Friday, including from Attorney General Eric H. Holder Jr. and Sen. Dianne Feinstein (D-Calif.).

Comey served as acting attorney general and was at the center of bruising debates over counterterrorism policies. He was regarded as a fierce defender of the law and nearly resigned in 2004 over concerns he raised about electronic surveillance orders he believed to be illegal.

But Comey has also come under fire from civil-liberties advocates for his role in signing off on some Bush-era “enhanced interrogation” techniques, such as waterboarding, which are considered torture under international norms. Comey called some of the techniques “wrong” and “simply awful” but approved their legality.

“Mr. Comey should use his confirmation hearing to publicly condemn all forms of torture and cruel treatment as illegal and immoral and to renounce those past decisions that permitted their use,” the St. Paul, Minn.-based Center for Victims of Torture said in a statement Friday. “He should also commit himself as FBI director to uphold legal and humane interrogation tactics in all FBI counterterrorism and counterintelligence activities.”

If confirmed by the Senate, Comey would take over the FBI as the administration faces questions about authorizing secret surveillance programs of U.S. citizens and foreigners.

Obama said Comey was “the perfect person” to carry on Mueller’s legacy of, in the president’s words, consistent integrity under pressure and “fidelity to values that make us who we are.”

“Like Bob, he’s that rarity in Washington sometimes,” Obama said of Comey. “He doesn’t care about politics; he only cares about getting the job done.”

As he introduced Comey in the Rose Garden, Obama made light of the nominee’s towering height. He quipped that Comey “stands very tall for justice and the rule of law.”

“I was saying while we were taking pictures with his gorgeous family here that they are all what Michelle calls ‘normal height.’ ”

In his remarks, Comey — the grandson of a patrolman who led the Yonkers, N.Y., police force and was later a prosecutor in New York and Virginia — said his wife, Patrice, and their five children had prepared him for the post.

“I must be out of my mind to be following Bob Mueller,” Comey said. “I don’t know whether I can fill those shoes, but I know that however I do, I will be standing truly on the shoulders of a giant — someone who has made a remarkable difference in the life of this country.”