Updated at 12:13 p.m. ET

Christopher Wray, President Trump's nominee to lead the FBI, said Wednesday morning that his loyalty is to the Constitution and the rule of law and vowed he would "never allow the FBI's work to be driven by anything other than the facts, the law and the impartial pursuit of justice. Period."

Wray is facing questions from members of the Senate Judiciary Committee during his confirmation hearing, and he made his pledge of loyalty to the Constitution and to the law more generally in prepared testimony published online just as the hearing was getting underway.

Wray also told senators he understood that the job of the FBI director was not "for the faint of heart" and assured the lawmakers that he was not.

The 50-year-old former Justice Department lawyer was named by Trump after the president fired James Comey. Comey had been overseeing the FBI's investigation of Russian meddling in last year's presidential election and possible ties between some top aides of the Trump campaign and Russia. Wray is facing several questions from senators that have arisen in the wake of Comey's dismissal and the controversy it generated.

Wray told the panel that he has "no reason to doubt the conclusions of the intelligence community" that Russia was behind the hacking of the election.

Wray was asked about emails released by the president's son Donald Trump Jr. detailing a meeting he had with a Russian lawyer who he thought was offering opposition research into Hillary Clinton's campaign on behalf of the Russian government. Wray said he had been busy meeting with senators about his nomination and had not read the media reports.

But he was pressed by Sen. Lindsey Graham, R-S.C. "You're going to be the director of the FBI, pal," Graham said, "so here's what I want you to tell every politician. If you get a call from somebody suggesting that a foreign government wants to help you by disparaging your opponent, tell us all to call the FBI."

Wray responded that "any threat or effort to interfere with our election from any nation state or any non-state actor is the kind of thing the FBI would want to know."

Asked about his support for the FBI investigation now being led by special counsel (and former FBI director) Robert Mueller, Wray said he was "very committed to supporting Director Mueller in the special counsel investigation in whatever way is appropriate for me to do that." Wray added that he would consider any effort to tamper with Mueller's investigation "unacceptable and inappropriate" and said it would need to be dealt with "very sternly."

Wray also said he did not believe Mueller's investigation to be "a witch hunt," as Trump has said more than once on Twitter.

Wray told Sen. Patrick Leahy, D-Vt., that no one had asked him for "any kind loyalty oath at any point in the process, and I sure as heck didn't offer one."

Asked by Leahy what he would do if asked by the president to do something illegal, Wray responded, "First, I would try to talk him out of it, and if that failed, I would resign."

While Wray praised former FBI Director Comey at moments during the hearing, he also offered some implied criticism of Comey for his public comments on the investigation into Clinton's private email server. Wray said he can't imagine a situation where, as FBI director, he "would be giving a press conference on an uncharged individual, much less talking in detail about it."

Wray is also likely to face questions about his clients in private practice, which include major corporations and New Jersey Gov. Chris Christie.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.