The feckless firing of their boss, James Comey, infuriated thousands of F.B.I. agents. The steady stream of tweeted presidential insults—the bureau’s reputation is “in tatters”, “FBI TAINTED”—has been plenty aggravating, too. Nevertheless, most agents went loyally about their investigatory business. But Donald Trump’s recent attack—promoting the idea that the F.B.I. planted a spy inside his campaign and is part of a “Criminal Deep State”—appears to have escalated anger inside the bureau to new levels, and that anger is bipartisan.

“There are too many examples to choose from over the past three years, but this ‘Deep State’ shit gets under peoples’ skin probably more than anything else, because it’s a criticism of your integrity,” says Robert E. Anderson Jr., who spent more than two decades at the F.B.I., rising to its No. 2 leadership post before retiring in 2015. “The notion that the bureau planted a spy in the president’s campaign is laughable, when you know how sources are run and how the rules work around counter-intelligence. It shows the naïveté of the people who are talking about it. Trump and his campaign staff, including Mike Flynn, who I’ve known for years, had no frickin’ clue what they were doing when it came to national security.”

Chuck Rosenberg, a former U.S. attorney and senior F.B.I. official, sees layers to the reaction inside the bureau. “There are two answers, and they are both true. The men and women of the F.B.I. do their jobs every day regardless of who the president is and what he might be saying, derisively, about them,” he says. “The other answer is that it adversely affects morale. People are steamed, and that’s what you’re seeing right now. They hate it when they’re out at their neighbor’s house in Sacramento at a Memorial Day cookout, and they’re asked about whether the F.B.I. really is politicized. Of course it is not.” Trump’s “Spygate” accusations have also darkened the mood at the bureau’s bureaucratic parent. “When you talk to people at the Department of Justice, there’s a sense of enduring frustration, and almost despondence, over the way the president treats the department,” says Matthew Miller, a top D.O.J. spokesman during the Obama administration. “And it boils over into anger when he does something really objectionable, like the campaign by Trump and his allies on the Hill to out a confidential F.B.I. source.”

Indeed, the emotional reaction at the bureau is fueled by the growing substantive cost, even in lower-profile investigations. “Whatever this vendetta is by the president against particular people in the bureau, it is hurting agents who have to testify in front of juries and need credibility,” says Asha Rangappa, a former F.B.I. counter-intelligence agent. “Where this stuff also really hits is in the relationships that agents have or are trying to cultivate with sources. It’s corroding trust and their ability to do the job.” Tom O’Connor is president of the F.B.I. Agents Association, whose 13,000 active-duty members helped disrupt, according to a federal inspector general's audit, more than 700 terrorist plots and dismantle 178 violent gangs in 2017. “We’re working our cases,” O’Connor says. “My concern is that if this type of political thing keeps going, people will fear coming to the F.B.I. to talk, because here’s the picture of an alleged confidential human source on the front page of a newspaper.”

Christopher Wray, who Trump installed to replace Comey as F.B.I. director in August 2017, gets generally high marks for his efforts to stabilize the bureau in the face of Trump’s assaults. “He’s very quiet, sort of the Bob Mueller approach,” Anderson says. “He’s writing nice internal e-mails trying to pick the morale back up, praising the men and women for the daily job they do.” Rosenberg, who is friendly with Wray, says the low-key approach is both consistent with Wray’s personality and strategically appropriate. “We’ve got an amazing director in Chris. But the folks in the field, the special agents working violent criminal gangs in Columbia, South Carolina, don’t fixate on the director. That’s not her main concern when she wakes up and goes to work, nor should it be,” Rosenberg says. “At headquarters, Chris has been well received, and deservedly so. I’m sure there were some suspicions about him at first, but I think he’s largely dispelled that. I am sure the political attacks bug him, and he’s pushed back, saying that the F.B.I. he knows and sees is apolitical. He’s bright and thoughtful, and will do very well in that incredibly difficult job.”

Anderson believes that at some point, most likely after special counsel Robert Mueller’s investigation is complete, the intelligence community will need to launch some kind of public-relations campaign to rebuild its image. “Overall, I don’t think that the spying accusations are a big hit to the bureau, because once they briefed Congress and the Senate, people came out and said there’s nothing wrong,” he says. “What’s worrisome is there’s a huge perception issue with the lay public. I’ve seen polls where this is the worst trust rating the F.B.I. has ever had.”

Which is precisely the larger game that Trump, his lawyer Rudy Giuliani, and California Congressman Devin Nunes have been playing—undermining the F.B.I.’s reputation as a way of undercutting Mueller’s eventual findings. Rosenberg, though, wonders if the strategy could boomerang inside the bureau. “The attacks are unfair and unprecedented, and it gets tiresome,” he says. “But it can have an unintended effect. Imagine you had a bunch of special agents in the New York field office looking at certain real-estate developers and their deals going back to the 1980s. Maybe they were working six days a week—and now they’re working seven.”