Wray testified before the House Judiciary Committee as Democrats and Republicans clashed over the significance of Trump’s attacks on the agency. In a storm of tweets last weekend, Trump called the nation’s top law enforcement agency a biased institution whose reputation is “in Tatters — worst in History!” and urged Wray to “clean house.”

Democrats are pushing Wray to respond forcefully, while Republicans echo Trump in suggesting they worry about political bias in special counsel Robert Mueller’s probe of possible Trump campaign ties to Russia during the 2016 presidential election.

Rep. Bob Goodlatte, R-Va., chairman of the committee, seized on revelations that an FBI agent was removed from Mueller’s team because of anti-Trump texts.

“It is absolutely unacceptable for FBI employees to permit their own political predilections to contaminate any investigation,” Goodlatte said. “Even the appearance of impropriety will devastate the FBI’s reputation.”

Rep. Jerrold Nadler of New York, top Democrat on the House Judiciary panel, predicted Trump’s attacks will only grow louder as Mueller continues investigating. “Your responsibility is not only to defend the bureau but to push back against the president when he is so clearly wrong, both on the facts and as a matter of principle,” Nadler told Wray.

Wray’s tenure as the new FBI chief would be difficult enough even without the intense scrutiny of the Russia investigation. Since he was sworn in on Aug. 2, the U.S. has experienced two of the deadliest shootings in its modern history and an attack seen as terrorism in Manhattan.

Trump’s weekend tweets created a fresh dilemma for Wray. With his bosses, Attorney General Jeff Sessions and Sessions’ deputy, Rod Rosenstein, staying publicly silent, it fell to Wray to defend the agency. But FBI directors traditionally have been low-key and stoic — with Wray’s predecessor, James Comey, a notable exception.

And Trump’s firing of Comey while he led the Russia probe shows what can happen to a director who antagonizes the president.