WASHINGTON — President Trump on Wednesday announced that he had selected Christopher A. Wray to be his F.B.I. director, turning to a former federal prosecutor who recently defended Gov. Chris Christie of New Jersey in the so-called Bridgegate scandal to lead an agency under a harsh political spotlight.
The president revealed his decision in an early-morning tweet without alerting members of Congress in advance. It came on the eve of a blockbuster congressional hearing scheduled for Thursday in which James B. Comey, the F.B.I. director he ousted abruptly last month, was to testify about what he interpreted as improper attempts by Mr. Trump to pressure him.
Hours after the Twitter post, the White House followed up with an official statement in which Mr. Trump called Mr. Wray “an impeccably qualified individual,” citing his role in major fraud investigations and antiterrorism efforts at the Justice Department after the 9/11 attacks.
The podcast that makes sense of the most delirious stretch of the 2016 campaign.
“I know that he will again serve his country as a fierce guardian of the law and model of integrity once the Senate confirms him to lead the F.B.I.,” Mr. Trump said in the statement.
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.”
Some civil liberties organizations expressed deep reservations about Mr. Wray, a litigation partner at King & Spalding, a law firm that advises Mr. Trump’s family real estate empire.
“Christopher Wray’s firm’s legal work for the Trump family, his history of partisan activity, as well as his history of defending Trump’s transition director during a criminal scandal makes us question his ability to lead the F.B.I. with the independence, evenhanded judgment, and commitment to the rule of law that the agency deserves,” said Faiz Shakir, the national political director of the American Civil Liberties Union, referring to Mr. Christie and the Bridgegate case.
Mr. Shakir said Mr. Wray would also have to “come clean about his role” in legal justifications for the use of torture during the Bush administration after the 9/11 attacks.
Mr. Wray, two administration officials said, is a hybrid selection for Mr. Trump: He is a seasoned criminal lawyer who bonded with Mr. Christie when both were young lawyers in the Justice Department, and a highly regarded criminal defense lawyer who represented Mr. Christie in the aftermath of the scandal over traffic jams that rocked his governorship.
That his political skills were honed in the crucible of scandal gave him an edge over the other finalist, John S. Pistole, a former deputy director of the F.B.I. and head of the Transportation Security Administration, the officials said. He managed to soothe and counsel the volatile Mr. Christie.
“Chris is a wonderful choice to lead the F.B.I. who cares deeply about the institution and already has strong relationships with the F.B.I.,” Alice Fisher, who followed Mr. Wray as chief of the Justice Department criminal division and was also interviewed to be F.B.I. director, wrote in an email. “His background at the helm of the criminal division offered an excellent experience working on national security, white-collar crime and a range of federal crimes.”
The pick caps an extraordinary period in which Mr. Trump has been buffeted by his own shifting explanations for why he dismissed Mr. Comey, allegations that he shared highly classified information with top Russian officials in the Oval Office and the naming of a special counsel to oversee the investigation into his campaign’s possible ties with Moscow.
The decision was being closely watched for signals about how the president will forge ahead amid the swirl of developments set off by Mr. Comey’s dismissal. Some Democrats have said impeachment proceedings should begin against him.
Mr. Trump met Tuesday with his two finalists, Mr. Wray and Mr. Pistole, the White House spokesman, Sean Spicer, said. The president had hoped to quickly pick a replacement for Mr. Comey before he embarked on his nine-day overseas trip in mid-May but was dissuaded from doing so by many of his top advisers, including the chief of staff, Reince Priebus, and Donald F. McGahn II, the White House counsel.
Mr. Wray played a pivotal role in the aftermath of the Sept. 11, 2001, terrorist attacks, providing oversight of Justice Department operations as the country adjusted to a new reality and working alongside Mr. Comey and Robert S. Mueller III, then the F.B.I. director and now a special counsel overseeing the Russia investigation. As head of the criminal division from 2003 to 2005, Mr. Wray directed efforts to deal with fraud scandals plaguing the corporate world.
Mr. Trump, who fired Mr. Comey without having put in motion a plan to find his successor, conducted a lengthy search, at one point zeroing in on Joseph I. Lieberman, the former Democratic senator and vice-presidential nominee, as a preferred finalist, even as he considered F.B.I. veterans including Adam S. Lee, the special agent in charge of the bureau’s Richmond, Va., field office; Richard A. McFeely, a former senior official; and Andrew G. McCabe, the acting director. Mr. Lieberman later withdrew from consideration.
“I’m encouraged that President Trump has nominated someone with significant federal law enforcement experience, rather than a career in partisan politics, as was rumored over the past several weeks,” said Senator Chris Coons, Democrat of Delaware and a member of the Judiciary panel.
It was during an interview with one of the prospective candidates at the White House that Mr. Trump received word of the appointment of Mr. Mueller as special counsel. Mr. Mueller is empowered to investigate a broad range of topics related to the Russia inquiry, potentially including the president’s own interactions with Mr. Comey.
While Mr. Wray’s reputation is not as a partisan operative, he has donated consistently to Republican candidates in recent years. Over the past decade, he has contributed at least $35,000 to Republican candidates or committees, according to data maintained by the Federal Election Commission. He did not do so during the 2016 election, but he has donated to Republican presidential nominees, including $2,300 to support Senator John McCain of Arizona in 2008 and $7,500 to back Mitt Romney in 2012.
Before joining the leadership of the Justice Department in Washington in 2001 as an associate deputy attorney general, Mr. Wray served as a federal prosecutor in Atlanta. He graduated from Yale University in 1989 and earned his law degree in 1992 from Yale Law School.
Republicans praised Mr. Trump’s choice even as they expressed surprise about the way in which it was unveiled.
“I learned about it from Twitter,” Senator Charles E. Grassley, Republican of Iowa and chairman of the Judiciary Committee, said in a corridor in the Capitol. “But then, I learn a lot of things about the president from Twitter.”