(U.S. Senate)

The Senate on Tuesday voted overwhelmingly to confirm Christopher A. Wray as the next FBI director, filling the critical post that has remained vacant since President Trump fired James B. Comey in May.

Trump’s firing of Comey immediately led to accusations that he was trying to impede the bureau’s investigation of Russian meddling in the 2016 presidential election and ultimately led to the appointment of special counsel Robert S. Mueller III. Comey later testified that Trump asked him for a “loyalty” oath and to drop an inquiry of former national security adviser Michael T. Flynn’s contacts with Russian officials.

Wray, a former senior Justice Department official known for his low-key demeanor, told lawmakers during his confirmation hearing that he would never pledge loyalty to the president and that if Trump ever pressured him to drop an investigation, he would push back or resign. This pledge appeared to gain him the confidence of Senate Judiciary Committee members, who unanimously approved his nomination and urged their colleagues to vote in favor of his confirmation.

The vote was 92 to 5; the lawmakers who voted against his nomination are all Democrats.

“He told the committee that he won’t condone tampering with investigations, and that he would resign rather than be unduly influenced in any manner. Mr. Wray’s record of service, and his reputation, give us no reason to doubt him,” Charles E. Grassley (R-Iowa), the panel’s chairman, said Tuesday. “He made no loyalty pledges then, and I expect him never to make such a pledge moving forward.”

(U.S. Senate)

Trump’s firing of Comey and his continued criticism of the Russia investigation have raised concerns in both parties about his respect for the historic independence of the FBI and its continuing counterintelligence probe of potential ties between his campaign and Kremlin officials.

Wray, 50, worked with Comey at the Justice Department during the George W. Bush administration, running the criminal division at the same time Comey was serving as deputy attorney general. Mueller — the special counsel in charge of the Justice Department’s investigation of alleged links between the Trump operation and the Kremlin — was serving as FBI director at the time.

During his confirmation process, Wray refrained from commenting directly on the Russia inquiry but did come to the defense of Mueller, who has been criticized by Trump and some of his supporters, saying he did not think he was on a “witch hunt,” as the president has said.

Wray also refrained from commenting on Comey’s tenure as FBI director but did offer him a nod of respect. He discussed the now famous 2004 episode in which Comey threatened to resign over the Bush administration’s warrantless surveillance program and said he was prepared to join him.

“Knowing those people, and that they were hardly shrinking violets in the war on terror, there was no hesi­ta­tion in my standing with them,” Wray said. He said he told Comey to let him know if they were about to resign, “and I’ll resign with you.”

But Wray was indirectly critical of Comey’s handling of an investigation of Hillary Clinton’s emails, telling senators that “I can’t imagine a situation where, as FBI director, I would be giving a news conference on an uncharged individual, much less talking in detail about it.”

Wray was also critical during his confirmation hearing of the Bush administration’s reliance on enhanced interrogation techniques, which critics call torture, disavowing 2008 testimony from former legal counsel John Yoo that Wray would have reviewed the memos approving those techniques.

(U.S. Senate)

“I have no recollection of that, and I think it’s the kind of thing I’d remember,” Wray said.

The clarification was critical in earning Wray the support of Sen. Dianne Feinstein (Calif.), the Judiciary Committee’s ranking Democrat.