The Justice Department inspector general on Thursday castigated former FBI Director James B. Comey for his actions during the Hillary Clinton email investigation and found that other senior bureau officials showed a "willingness to take official action" to prevent Donald Trump from becoming president.

The 500-page report, documenting major missteps in one of the most politically charged cases in the FBI's history, provides the most exhaustive account to date of bureau and Justice Department decision-making throughout the investigation of Clinton's use of a private email server, particularly in the months just before she would lose the presidency to Trump.

Though the inspector general condemned individual FBI officials, the report fell significantly short in supporting the assertion by the president and his allies that the investigation was rigged in favor of Clinton. The inspector general found "no evidence that the conclusions by department prosecutors were affected by bias or other improper considerations." The report acknowledged that certain emails appeared to contain classified information, but investigators determined the FBI's conclusion that Clinton did not intend to expose classified information was legitimate.

The report is a blistering public rebuke of Comey, who has spent recent months on a book tour promoting his brand of ethical leadership. Inspector general Michael Horowitz accused Comey of insubordination, saying he flouted Justice Department practices when he decided only he had the authority and credibility to make key decisions and speak for the Justice Department.

Comey made a "serious error of judgment" in sending a letter to Congress on Oct. 28 announcing he was reopening the investigation of Clinton's use of the server while secretary of state, the report found, and called it "extraordinary that Comey assessed that it was best" for him not to speak directly with either the Attorney General or the Deputy Attorney General about his decision beforehand.

Some senior bureau officials, the report found, exhibited a disturbing "willingness to take official action" to hurt Trump's chances to become president.

Perhaps the most damaging new revelation in the report is a previously-unreported text message in which Peter Strzok, a key investigator on both the Clinton email case and the investigation of Russia and the Trump campaign, assured an FBI lawyer in August 2016 that "we'll stop" Trump from making it to the White House.

"[Trump's] not ever going to become president, right? Right?!" the lawyer, Lisa Page, wrote to Strzok.

"No. No he won't. We'll stop it," Strzok responded.

In a message posted to Twitter on Thursday afternoon, Comey wrote: "I respect the DOJ IG office, which is why I urged them to do this review. The conclusions are reasonable, even though I disagree with some. People of good faith can see an unprecedented situation differently. I pray no Director faces it again. Thanks to IG's people for hard work."

In a statement, Attorney General Jeff Sessions said the "significant errors" cited in the report had taken place during the Obama administration.

"Accordingly, this report must be seen as an opportunity for the FBI — long considered the world's premier investigative agency — and all of us at the Department to learn from past mistakes," Sessions said.

Sessions said that a new leadership team brought in by Comey's replacement, FBI Director Christopher A. Wray, was "one in which the American people can have confidence."

"Mistakes were made," the FBI said in a lengthy statement issued in response to the report. The bureau admitted to "errors of judgment, violations of or disregard for policy, or, when viewed with the benefit of hindsight, simply not the best courses of action. They were not, in any respect, the result of bias or improper considerations."

The report aimed to define once and for all what the FBI and Justice Department did right and what was wrong in the Clinton probe, but partisans are likely to seize on different findings to buttress their long-held views about that investigation.

For Trump, the report provides chapter upon chapter of fresh ammunition for his attacks on the FBI, which he has accused of political bias in investigating whether any of his campaign associates may have conspired with Russia to influence the 2016 election.

To Clinton and her supporters, who have long argued that Comey's decisions robbed her of an election victory, the report will likely be received as bitter vindication of her claims the FBI Director veered far beyond official policy in speaking publicly about her case, and reopening it in the final days before the election.

Partisans on both sides sought to cast the report to their advantage even before it was formally released.

"The stark conclusion we draw after reviewing this report is that the FBI's actions helped Donald Trump become President," Reps. Jerrold Nadler (D-N.Y.) and Elijah E. Cummings (D-Md.) said in a joint statement. "As we warned before the election, Director Comey had a double-standard: he spoke publicly about the Clinton investigation while keeping secret from the American people the investigation of Donald Trump and Russia."

Rep. Darrell Issa (R-Calif.) offered a very different take, calling the report "a damning indictment of former FBI director Comey and the Department of Justice's mishandling of the investigation."

Trump offered no immediate reaction after being briefed on the report before its formal release, but fired off a pair of tweets renewing his attack on the Russia investigation, which he called "pile of garbage."

The White House scheduled an afternoon press briefing at which the report was certain to be a major topic.

In a speech on the Senate floor, Minority Leader Charles E. Schumer (D-N.Y.) sought to preempt any claims by Trump that the report would show that bias against him by FBI officials has affected the Russia probe.

"There is no reason — no reason — to believe that it will provide any basis to call the special counsel's work into question," Schumer said. "The IG report concerns an entirely separate investigation from the Russia probe that special counsel Mueller is conducting."

The inspector general concluded that Strzok's text, along with others disparaging Trump, "is not only indicative of a biased state of mind but, even more seriously, implies a willingness to take official action to impact the presidential candidate's electoral prospects."

The messages "potentially indicated or created the appearance that investigative decisions were impacted by bias or improper considerations," the inspector general wrote.

Strzok told investigators he believed the message "was intended to reassure Page that Trump would not be elected, not to suggest that he would do something to impact the investigation," according to the report. Both he and Page generally defended their messages as instances of sharing personal opinions that did not affect their work.

"I'm an American. We have the First Amendment. I'm entitled to an opinion," Page told investigators.

Even that defense, however, undercuts Comey, who had long proclaimed that his investigators "don't give a rip about politics."

Horowitz has been working for nearly a year and a half to assess the bureau's handling of the Clinton email investigation and its actions in the months leading up to the election, and all of Washington has eagerly been awaiting his findings. The president, who was briefed on the report before it was released publicly, has vigorously criticized Comey and the FBI.

Trump is all but certain to use the findings to renew those assaults, and potentially take aim at special counsel Robert S. Mueller III. Strzok served as Mueller's lead agent on the Russia probe until last July, when he was removed following the discovery of the text messages.

David Laufman, who oversaw the Clinton probe as chief of the National Security Division's Counterintelligence and Export Control Section, said, "The IG report demonstrates that the Justice Department lawyers who conducted the Clinton email investigation carried out their duties with the utmost rigor, professionalism, and integrity."

Horowitz also concluded there was no evidence that political bias infected Comey's thinking, even as he criticized individual steps Comey took. The report, for example, called Comey's July 2016 public recommendation that Clinton not be charged an "extraordinary and insubordinate" move, because Comey did not even tell then-Attorney General Loretta E. Lynch what he was about to do. But it added, "we found no evidence that Comey's statement was the result of bias or an effort to influence the election."

Comey was not the only official to face criticism. The report chided Lynch for indecision after meeting with former president Bill Clinton on the tarmac of the Phoenix airport in the late stages of the campaign. She neither recused herself from the case to avoid the appearance of impropriety, nor did she assert herself more vigorously as Comey seized command.

The report similarly raised questions about how the FBI handled the ultimate recusal of the FBI deputy director, Andrew McCabe, from that and other cases because of political donations his wife had received from a group controlled by Terry McAuliffe, a Clinton ally.

Page and Strzok are not the only FBI officials assigned to the Clinton email probe who were found to have exchanged personal messages indicating either an animus against Trump or frustration with the fact that the FBI was investigating Clinton. The report identified five officials with some connection to the email probe who were expressing political views, faulting them for having brought "discredit to themselves, sowed doubt about the FBI's handling of the midyear investigation, and impacted the reputation of the FBI." The midyear investigation refers to the Clinton email probe.

"The messages cast a cloud over the FBI investigations to which these employees were assigned," Horowitz alleged. "Ultimately the consequences of these actions impact not only the senders of these messages but also other who worked on these investigation and, indeed, the entire FBI."

The inspector general wrote that it had referred the information regarding the five individuals who exchanged politically-charged messages "to the FBI for its handling and consideration of whether the messages ... violates the FBI's Offense Code of Conduct."

The report took particular aim at FBI officials investigating Clinton's email server for moving slowly after agents in the New York Field office discovered messages on the laptop of disgraced former Congressman Anthony Weiner that might be relevant to their case.

By no later than September 29, the inspector general alleged, the bureau had learned "virtually every fact" it would cite as justification late the next month to search Weiner's laptop for messages of Clinton and top aide Huma Abedin.

The inspector general derided the bureau's reasons for not moving more quickly — that agents were waiting for additional information from New York, that they couldn't move without a warrant and that investigators were more focused on the Russia case — as "unpersuasive," "illogical," and inconsistent with their assertion that they would leave no stone unturned on Clinton.

The report also faulted the bureau for assigning essentially the same personnel to the Russia and Clinton teams, and singled out Strzok, suggesting his anti-Trump views might have played a role in his not acting more expeditiously on the new lead.

"Under these circumstances, we did not have confidence that Strzok's decision to prioritize the Russia investigation over following up on the Midyear-related investigative lead discovered on the Weiner laptop was free from bias," the report said.

The report determined that several FBI investigators — including Comey — also broke bureau protocol by using "personal email accounts for official government business."

The inspector found five instances in which Comey either drafted official messages on or forwarded emails to his personal account, and at least two instances in which Strzok used his personal email for official business — including one "most troubling" instance on October 29, 2016, when he forwarded "an email about the proposed search warrant the midyear team was seeking on the Weiner laptop" from his FBI account to his personal email.

The discovery is ironic, given that the FBI was exploring Clinton's own use of a personal email for work related business and whether classified information traversed her server.