Christopher A. Wray faces a hearing Wednesday before the Senate Judiciary Committee on his nomination to become the FBI’s eighth director. (Andrew Harrer/Bloomberg)

When Christopher A. Wray hired a new deputy at Justice Department headquarters in the summer of 2003, he issued a warning: There could come a moment when they might have to resign rather than carry out an order that violated their sense of the law.

Within a year, that warning proved prophetic.

Wray, then the head of the Justice Department’s criminal division, heard that the higher-ups at the department — including then-Deputy Attorney General James B. Comey and then-FBI Director Robert S. Mueller III — were preparing to resign in a dispute with the Bush administration.

Wray pulled Comey aside to tell him he would follow his lead. If Comey resigned, he would, too.

Next, he came to his deputy, John Richter, who recalled that Wray said, “John, I can’t tell you what’s going on upstairs, but do you remember that conversation we had in the summer? Well, we may know by the end of the day if we have to resign.’’ Hearing that, Richter said, he “swallowed hard and went back to work.’’

(Jenny Starrs/The Washington Post)

Questions about Wray’s ability to be an independent leader, resistant to political pressures, are expected to dominate his hearing Wednesday before the Senate Judiciary Committee to become the FBI’s eighth director. He would take over an agency still reeling from President Trump’s abrupt firing of Comey less than four years into the director’s 10-year term.

And Mueller is now the special counsel leading the FBI’s investigation into whether Trump associates coordinated with agents of the Russian government during the 2016 presidential campaign. Officials familiar with that work say it includes an examination of whether the president may have attempted to obstruct one of those investigations.

Historically, nominees for FBI director get wide bipartisan support; Comey was confirmed by a 93-to-1 vote. Wray has already won support from the FBI Agents Association, but some inside the agency worry that the nature of Comey’s ouster and the president’s persistent dismissals of the Russia probe could lead to more partisan rancor in Wray’s confirmation process.

Richter and other friends of Wray’s say his career has prepared him to manage White House expectations while preserving the traditional independent operations of federal law enforcement.

When Wray offered to resign in solidarity with Comey, he did not even know the nature of the dispute, said Richter, which later was revealed to be over a White House demand that Comey further authorize a warrantless surveillance program.

Wray’s offer was not simply an act of loyalty or friendship, Richter said. “This was about multiple lawyers who were hard-nosed, tough-on-terror types. When he heard they had concerns, that suggested to him there was a real issue here,’’ he recalled.

Before settling on Wray, Trump interviewed a number of politicians for the FBI job, alarming both agents at the agency and Democrats wary of what they call his past attempts to influence FBI investigations.

In Wray, 50, the president chose an accomplished lawyer with a classic establishment pedigree: Yale Law School, a clerkship for a respected and conservative appeals court judge, both white-shoe corporate law experience and a strong résumé as a former federal prosecutor who rose high within Justice’s ranks. However, Wray’s stint in President George W. Bush’s administration, in the aftermath of the 2001 terrorist attacks, could revive past debates about mistreatment of detainees, civil rights and prosecutorial independence.

Civil liberties and human rights groups hope lawmakers will press Wray to explain what he knew about detainee abuse during the post-9/11 war on terrorism. According to documents obtained by the American Civil Liberties Union, the CIA notified Wray in February 2004 of possible “violations of federal criminal law” arising from the death of an Iraqi detainee at Abu Ghraib prison in Baghdad. Three months later, when he was head of the criminal division, he testified to Congress that his “principal awareness” of any abuse was “through the news media.” When pressed, he said he was “not aware of any referral from the Department of Defense” to the Justice Department or the FBI relating to detainee abuse.

“Wray should explain what he knew about detainee abuses, when he knew about them, what actions he did or did not take and why,” said Laura Pitter, senior U.S. national security counsel for Human Rights Watch.

Said Richter, who worked closely with Wray during that time: “Chris Wray believes that torture, including waterboarding, is wrong, ineffective, and illegal.”

Some veteran federal law enforcement officials said they greeted Wray’s nomination with a mixture of relief and worry — relief that Wray was one of the best names circulating as a candidate; worry that he lacks the reputational heft of a Comey or Mueller to lead the agency at a time when it is under attack from the president.

Wray has been in private practice for more than a decade, representing big corporate clients such as Credit Suisse in a major tax-evasion case, and New Jersey Gov. Chris Christie (R), in a probe of his administration’s decision to change traffic patterns on the George Washington Bridge, apparently to punish a political foe.

Christie was never charged in that case, but in an unusual twist of timing, one of the governor’s former aides is scheduled to be sentenced in federal court in New Jersey on Wednesday, the same day as Wray’s confirmation hearing.

As a young lawyer, Wray rose through the ranks by exceeding his bosses’ expectations.

Kent Alexander was a partner at King & Spalding in Atlanta when he gave Wray, then in his last week as a summer associate, a tough assignment — complex legal analysis for a bank. The night before it was due, the firm’s partners took Wray to a Braves game to woo him as a future partner.

“At that point, I figured I’d be lucky just to get a manila folder with copies of a few regulations,” Alexander recalled. “Instead, on his way out the door, Chris dropped off a brilliantly crafted and researched analysis that addressed every one of the bank’s issues. I couldn’t have done it better if given a month.’’

When he became U.S. attorney in Atlanta, Alexander hired Wray as a federal prosecutor, working under Sally Yates — who would go on to become a deputy attorney general in the Obama Justice Department and acting attorney general under President Trump. Trump fired her in a disagreement about his travel ban executive order.

As a young federal prosecutor in Atlanta, Wray found himself in the unusual situation of facing off in court against his mentor, King & Spalding lawyer Larry Thompson. Wray was prosecuting a corruption case; Thompson represented one of the defendants.

Joe Robuck, the FBI agent on the case, warned the young prosecutor that battling a friend in a high profile, high-stakes trial could undermine his relationship with Thompson.

“I don’t think that’s going to be an issue,’’ Wray replied, according to Robuck.

It wasn’t.

The jury convicted Thompson’s client, but instead of becoming angry, Thompson hired Wray. When President George W. Bush tapped Thompson in 2001 to become the No. 2 official at the Justice Department, Thompson hired Wray, who soon became his right-hand man.

“He’s a very smart, very careful lawyer,” Thompson said. “Chris does not make mistakes. And most importantly, for what people may be interested in for our new FBI director, he doesn’t seek the limelight.”

Wray’s supporters repeatedly refer to his temperament as one of his best attributes, calling him a razor-sharp but low-key manager who looks to defuse tense situations, not escalate them.

Trump had complained that Comey was a showboat. Whatever the merits of that accusation, it is not one that has ever been leveled against Wray.

Thompson said he cannot imagine Wray ever giving a news conference, as Comey did, to announce the closing of the Clinton email investigation and then discussing it at length.

“It absolutely never would happen,’’ Thompson said. “You could knock me over with a feather if that happened,” he said.

ellen.nakashima@washpost.com