For indispensable reporting on the coronavirus crisis, the election, and more, subscribe to the Mother Jones Daily newsletter.

Christopher Wray, President Donald Trump’s pick to head the FBI, earned support from members of the Senate Judiciary Committee in both parties Tuesday, in part by disagreeing with Trump at almost every chance he got. Several committee Democrats, including the panel’s ranking member, Sen. Dianne Feinstein (D-Calif.), announced they would vote to confirm Wray, likely assuring that he will become the agency’s new director.

Trump sparked a political firestorm in May when he dismissed the previous FBI director, James Comey, who at the time was leading the investigation into Russian meddling in the 2016 presidential election and possible coordination between Trump associates and the Kremlin. According to Comey, Trump at one point requested that Comey pledge loyalty to the president—a request Comey refused. Trump has disputed that account.

“I do not consider Director Mueller to be on a witch hunt.”

Wray told the committee he would have answered the same way. “No one asked me for any kind of loyalty oath, and I sure as heck didn’t offer one,” he said. “My loyalty is to Constitution, the rule of law, and to the mission of the FBI.”

That wasn’t the only time Wray staked out a position that was seemingly at odds with Trump.

The White House has claimed Trump has the right to fire Special Counsel Robert Mueller, who took over the Justice Department’s Russia investigation after Comey’s firing. Wray said he wasn’t sure of the law surrounding the president’s power to dismiss the special prosecutor, but he told senators that as long as the agency’s legal advisers okayed it, he would report any attempt by the White House to interfere in Mueller’s probe.

“I would consider an effort to tamper with Director Mueller’s investigation to be unacceptable and inappropriate and would need to be dealt with very sternly and appropriately indeed,” Wray said.

Questioned by Sen. Al Franken, (D-Minn.), Wray rejected two of Trump’s assertions about Comey, who Wray worked with at the Justice Department under President George W. Bush. Franken asked if Comey, lost the confidence of rank-and-file FBI agents and hurt morale within the bureau, as White House spokeswoman Sarah Huckabee Sanders has claimed,

Wray suggested Comey had not. “All the people I’ve spoken with, ” he said, “from senior people to rank-and-file people…are mission focused” and “charging ahead.”

Franken also asked about Trump’s reported description of Comey as a “nut job.”

“That has never been my experience with him,” Wray said.

Some of Wray’s most pointed disagreements with Trump came under questioning by Sen. Lindsey Graham (R-S.C.).

Trump has called the investigation into whether his campaign coordinated with the Kremlin “a witch hunt.” Graham asked Wray if he agreed.

“I do not consider Director Mueller to be on a witch hunt,” Wray said.

In the wake of news that Donald Trump Jr. organized a meeting of Trump campaign officials in June 2016 with a Russian lawyer he hoped would transmit damaging information on Hillary Clinton provided by the Russian government, the president issued a statement stating his son is “a high-quality person and I applaud his transparency.”

Wray did not endorse that statement. At Graham’s behest, he said a person in a situation like Trump Jr.’s should contact a lawyer and federal authorities.

“Any threat or offer to interfere in our election from any national state or any nonstate actor is the kind of the thing the FBI would want to know about,” he said.

Trump has not fully accepted the US Intelligence Community’s assessment that Russia interfered in the 2016 election to help secure his election, and he agreed in a meeting last week with Russian President Vladimir Putin to “move forward” on relations after Putin denied that Russia meddled. Russian Foreign Minister Sergey Lavrov claimed Trump told Putin there is “no proof” that the Kremlin oversaw the hacking of Democratic National Committee and Clinton campaign emails.

Wray said he had “no reason to doubt” the intelligence agencies’ findings. He said “an effort to interfere with our election is an adversarial act.

During his presidential campaign, Trump said he would bring back waterboarding and “a hell of a lot worse than waterboarding.” Trump has insisted that torture “works.”

Pressed by Feinstein, Wray flatly disputed Trump’s claim. “Torture is wrong,” Wray said. “It’s unacceptable. It’s illegal, and I think it’s ineffective.”

As a candidate, Trump advocated a ban on Muslims entering the United States, which he has pushed in a modified form as president. As a candidate he routinely linked Islam to violence and declared that “Islam hates us.” Trump has also suggested that Muslims do not do enough to report terrorists in their communities.

Wray on Wednesday emphasized the difference between patriotic Muslim Americans and terrorists. “Some of the best leads we ever got came from members of that community,” he said of his experience as a federal prosecutor. Wray referred to people with a “radical ideology,” avoiding the link between terrorism and Islam that Trump proudly draws when he uses the phrase “radical Islamic terror.”

Wray told committee members he would quit his post rather than accept instructions from Trump that he considered illegal or unethical.

“I would try to talk him out of it,” he said. “And if that failed, I would resign.”