The selection may have been an attempt to inject credibility into an investigation of his campaign’s possible ties with Russia, one that has been rocked by accusations of presidential tampering.

Mr. Wray is a safe, mainstream pick from a president who at one point was considering politicians for a job that has historically been kept outside of partisanship. A former assistant attorney general overseeing the Justice Department’s criminal division under President George W. Bush, Mr. Wray is likely to allay the fears of F.B.I. agents who worried that Mr. Trump would try to weaken or politicize the F.B.I.

“Christopher Wray knows the Justice Department, is not a politician, and has a background in federal law enforcement,” Senator Sheldon Whitehouse, Democrat of Rhode Island and a member of the Judiciary Committee, said in a statement, calling those his “minimum qualifications” for the next agency director. “Above all, he will need to show his commitment to protecting the bureau’s independence. That independence is more important than ever given the inevitable conflicts with the interests of the man who sits in the Oval Office.”

Those concerns were only stoked on Wednesday with the release of prepared testimony by Mr. Comey in which he recounted how Mr. Trump at one point asked him to shut down the bureau’s investigation of Michael T. Flynn, his former national security adviser, whose ties with Russia are under investigation. Mr. Comey also said that the president had repeatedly pressed for him to say publicly that Mr. Trump was not personally under investigation.

“In light of the president’s constant efforts to block the truth,” said Representative Nancy Pelosi of California, the minority leader, “the nomination of Christopher Wray should be subject to the utmost scrutiny.”