WASHINGTON — As F.B.I. director, James B. Comey had widespread support from his agents, according to internal survey data released Wednesday that contradicts President Trump’s claim that he fired Mr. Comey in part because agents had lost confidence in him.

Mr. Comey’s firing is among many topics now under investigation by the Justice Department special counsel, Robert S. Mueller III. Mr. Trump and his aides have offered changing explanations for why he fired Mr. Comey, who was overseeing the investigation into Mr. Trump’s associates and possible links to Russia’s election interference.

The F.B.I. released the results of three years of internal questionnaires in response to a public records request by The New York Times. The surveys revealed that agents around the country gave the F.B.I. leadership high marks — 4.01 on a scale of 5 — in this year’s survey. The F.B.I. considers scores over 3.81 an indication of success.

Mr. Trump has repeatedly cast Mr. Comey in a negative light.

“He’s a showboat, he’s a grandstander, the F.B.I. has been in turmoil,” Mr. Trump said of Mr. Comey in an NBC interview in May. “You know that. I know that. Everybody knows that. You take a look at the F.B.I. a year ago, it was in virtual turmoil, less than a year ago. It hasn’t recovered from that.”