WASHINGTON — President Trump’s harsh criticism of the F.B.I. elicited a rare and impassioned defense on Thursday from its director, Christopher A. Wray, even as he noted “no shortage of opinions out there” about the bureau.
Mr. Wray’s comments to the House Judiciary Committee may as well have described Mr. Trump’s own shifting stances on the F.B.I., C.I.A. and other federal agencies that do intelligence and law enforcement work.
A review of Mr. Trump’s comments during and after the 2016 presidential campaign reveals his eagerness to praise them when they investigate his opponents. He is quick to rebuke them, however, when their actions do not align with his interests.
Presidents normally refrain from commenting on or interfering with law enforcement investigations or intelligence analyses to avoid being seen as politicizing them.
Most recently, Mr. Trump tweeted on Sunday that the F.B.I.’s “reputation is in Tatters — worst in History!” following last week’s guilty plea by Michael T. Flynn, the former White House national security adviser, for lying to investigators. Mr. Trump also suggested, falsely, that the F.B.I. refused to charge Hillary Clinton for lying — a claim its former director, James B. Comey, has refuted multiple times.
It was a reach back to the sharp words that Mr. Trump reserved for intelligence and law enforcement agencies during last year’s presidential campaign.
Time and again, Mr. Trump railed against Mr. Comey and the F.B.I. early last fall for closing an investigation into Mrs. Clinton’s handing of classified information on a private email server without bringing charges.
“I would think that some of these great F.B.I. agents, and the people that work within the F.B.I., I would imagine that they are just furious at what’s happened to the reputation of the F.B.I.,” Mr. Trump said at one campaign rally, in New Hampshire, on Oct. 6.
The next day, on Oct. 7, two top American spy agencies released an intelligence assessment that the Russian government had hacked into the Democratic National Committee with the intent “to interfere with the U.S. election process.” The assessment, by the Office of the Director of National Intelligence and the Homeland Security Department, came after Mr. Trump had complimented President Vladimir V. Putin of Russia and cast doubt on Moscow’s role in the email hacking.
“Maybe there is no hacking,” Mr. Trump said on Oct. 9, in the second presidential debate. “But they always blame Russia. And the reason they blame Russia because they think they’re trying to tarnish me with Russia.”
Once Mr. Trump believed things were going his way, however, he was quick to embrace the intelligence community, which is made up of 17 federal agencies, including the F.B.I. and the C.I.A.
In the final days of the presidential campaign, on Oct. 28, Mr. Comey advised Congress that he was examining new evidence in the closed F.B.I. investigation of Mrs. Clinton’s private email server. Mr. Trump responded by praising Mr. Comey’s “guts” and said the F.B.I. was doing a “good job.” He also condemned Mrs. Clinton for her criticisms of the F.B.I.
“There’s virtually no doubt that F.B.I. Director Comey and the great, great special agents of the F.B.I. will be able to collect more than enough evidence to garner indictments against Hillary Clinton and her inner circle, despite her effort to disparage them and discredit them,” he said at a Nov. 5, 2016, rally in Nevada.
The intelligence assessment about Russian election meddling still irritated him, however — even after he won the presidency. In an unsigned Dec. 10 statement, Mr. Trump’s transition team disparaged the American intelligence community by mocking its role in the lead-up to the Iraq war nearly 15 years earlier. “These are the same people that said Saddam Hussein had weapons of mass destruction,” the statement said. (That 2002 assessment long has been a sore spot for the C.I.A.)
Mr. Trump tweeted on Jan. 5 that he was a “big fan” of the intelligence community. But at a Jan. 11 news conference, he called described a new report on Russian election interference as “a disgrace” and a “tremendous blot on their record.”
By Jan. 21, the day after his inauguration, he was back to praising the intelligence community with a visit to C.I.A. headquarters in Langley, Va., where he told officers and analysts, “I am so behind you.”
The whiplash has only continued over his first year in office.
In February, Mr. Trump denounced the F.B.I. over leaks in the investigation of contacts between his associates and Russian intelligence officials.
After he fired Mr. Comey on May 9, Mr. Trump said the F.B.I. “was in a virtual turmoil” and “hasn’t recovered from that.”
By August, after he had named Mr. Wray the new F.B.I. director, Mr. Trump said in a news conference that he has “great respect for the intelligence community” — leaks aside.
In early November, again frustrated by the Russia investigation, Mr. Trump lamented Mr. Comey’s leadership as a “disaster” and tweeted that the F.B.I. was “once cherished and great.”
But a week later, at a Nov. 11 news conference in Vietnam, Mr. Trump declared his support for the intelligence community.
“I believe in our intel agencies, our intelligence agencies. I’ve worked with them very strongly,” he said.