Former FBI director James B. Comey, seen in 2018, violated FBI policies in how he handled memos that detailed his interactions with the president, the Justice Department’s inspector general found. (J. Scott Applewhite/AP)

Former FBI director James B. Comey violated FBI policies in how he handled memos that detailed his controversial interactions with President Trump, setting a “dangerous example” for bureau employees about substituting personal righteousness for established rules, the Justice Department’s internal watchdog found in a report released Thursday.

The inspector general criticized Comey for keeping the government documents at his home, engineering the release of some of their contents to the news media and not telling the bureau to whom he had given them — even after he was aware that some contained classified information.

Comey told investigators that he felt the memos were personal and that he was acting in the best interests of the country. But the inspector general rejected that defense, writing that Comey’s senior FBI leaders all agreed the memos were government documents, and that the former director’s “own, personal conception of what was necessary was not an appropriate basis for ignoring the policies and agreements governing the use of FBI records.”

“The responsibility to protect sensitive law enforcement information falls in large part to the employees of the FBI who have access to it through their daily duties,” the inspector general wrote. “Former Director Comey failed to live up to this responsibility.”

By now, Comey’s memos are well-known. They described, among other things, how Trump had pressed Comey for loyalty and had asked him about letting go of an investigation into former national security adviser Michael Flynn.

Comey’s orchestration of the release of their contents helped spark special counsel Robert S. Mueller III’s appointment to investigate possible coordination between the Trump campaign and Russia to affect the 2016 election. Mueller would go on to focus intently on the episodes Comey described as possible obstruction of justice by the president.

Trump on Thursday seized on the findings to lash out at Comey.

“Perhaps never in the history of our Country has someone been more thoroughly disgraced and excoriated than James Comey in the just released Inspector General’s Report,” he tweeted. “He should be ashamed of himself!”

In total, the inspector general wrote, Comey wrote seven memos, documenting most of the nine one-on-one conversations he had with Trump in early 2017, just before he was fired.

Comey left three memos at the FBI, the inspector general wrote. He stored the other four documents in a safe in his home and provided copies to his personal attorneys, the inspector general found. Of those four, he gave one — which included information the inspector general called “sensitive” but unclassified — to a friend and authorized him to share its contents.

One of those memos shared with the attorneys was later determined to contain information that was classified as confidential, the lowest level of secrecy, after a review that included Comey’s FBI general counsel, the inspector general wrote.

The confidential material in that memo entailed just six words “from a statement by President Trump comparing the relative importance of returning telephone calls from three countries,” the inspector general wrote. Another memo Comey kept contained a classified “assessment of a foreign leader by President Trump,” though Comey redacted that before providing it to his attorneys, the inspector general wrote.

On Twitter, Comey noted that the inspector general found “no evidence” that he or his attorneys released any classified information to the media.

“I don’t need a public apology from those who defamed me, but a quick message with a ‘sorry we lied about you’ would be nice,” he wrote. “And to all those who’ve spent two years talking about me ‘going to jail’ or being a ‘liar and a leaker’— ask yourselves why you still trust people who gave you bad info for so long, including the president.”

Trump has previously attacked Comey over the memos and called him a “proven liar and leaker.”

The report is the second time Inspector General Michael Horowitz has criticized Comey for how he handled FBI business during his abbreviated tenure in charge of the bureau. Last summer, Horowitz lambasted Comey for his leadership of the investigation into Hillary Clinton’s use of a private email server while she was secretary of state, accusing him of insubordination and flouting Justice Department policies in deciding only he had the authority and credibility to make key decisions on the case and speak about it publicly.

The inspector general wrote that his office gave its findings to the Justice Department to determine whether Comey had committed a crime and that officials declined to prosecute the case. Conservatives, though, used the finding to attack Comey.

Senate Judiciary Committee Chairman Lindsey O. Graham (R-S.C.) said in a statement that it was a “stunning and unprecedented rebuke of a former Director of the FBI.”

George J. Terwilliger III, a former deputy attorney general and acting attorney general under George H.W. Bush, said the inspector general had described “a gross abuse of institutional power and authority.”

“And for someone who claims on a regular basis the mantle of righteousness, Comey should be ashamed of what he did,” Terwilliger said.

Former deputy attorney general Rod J. Rosenstein, who appointed Mueller and has been conspicuously critical of Comey, seemed to draw attention to the report in a tweet on Thursday, quoting from a letter he penned in 2018 to the Senate Judiciary Committee that talked of following the rules.

“It is important .. to follow established policies and procedures, especially when the stakes are high,” Rosenstein wrote. “We should be most on guard when we believe that our own uncomfortable .. circumstances justify ignoring .. principles respected by our predecessors.”

That Comey had in his possession material that was later deemed classified and shared it with his lawyers has also rankled liberals. It was Comey, after all, who said Clinton and her aides were “extremely careless” in their handling of classified information in their use of a private email server.

Many Clinton supporters say the FBI’s investigation into that matter — and Comey’s revelation on the eve of the 2016 election that the case was resuming — cost her the presidency. As an FBI employee, Comey had to surrender all bureau materials upon leaving his job and abide by a “lifelong” duty to protect classified material, the inspector general wrote.

The New York Times first made some of the contents of Comey’s memos public on May 11, 2017, publishing a story about how, at a private dinner, Trump asked him for the loyalty pledge. Later, it published another story detailing Comey and Trump’s conversation about Flynn.

Comey would later admit that he had engineered the release of some of that information through a friend, Daniel Richman, a Columbia Law School professor who served as a special government employee at the FBI while Comey was director. Comey claimed he did not authorize Richman to serve as a source for the story on May 11, but did for the later piece.

None of it was authorized by the FBI. When Comey revealed what he had done at a June 2017 congressional hearing, senior bureau leaders were taken aback, the inspector general wrote.

Earlier that month, Comey had reviewed the memos and seen the classification markings the FBI had applied to the memos after he had left, the inspector general wrote.

FBI officials scrambled to get in touch with Richman, who told them Comey had also shared the material with his other lawyers, the inspector general wrote.

The memo provided to Richman was determined to be “For Official Use Only” but did not contain classified information, the inspector general wrote. But because other memos Comey shared with attorneys had material deemed classified, officials had to track down who had accessed the documents so they could be secured, the inspector general wrote.

“Members of Comey’s senior leadership team used the adjectives ‘surprised,’ ‘stunned,’ ‘shocked,’ and ‘disappointment’ to describe their reactions to learning that Comey acted on his own to provide the contents of Memo 4, through Richman, to a reporter,” the inspector general wrote.

The man who subsequently became the acting head of the FBI, Andrew G. McCabe, referred the matter to the inspector general in July 2017, the inspector general wrote. The inspector general said a decision on what to do next lies with the FBI and Justice Department’s Office of Professional Responsibility.