The Justice Department's internal watchdog has concluded that the FBI's most controversial decisions during the 2016 presidential election were not politically motivated, but the FBI's reputation has nonetheless been hurt by the actions of some of its agents – findings that come after a nearly two-year assault on the FBI by Donald Trump and other Republicans alleging FBI officials allowed political considerations to influence investigations.

However, in the nearly 500-page report released Thursday, Inspector General Michael Horowitz said he could not discount that political bias played a role in the FBI's delay in analyzing a laptop with potential evidence tied to Hillary Clinton's use of a private email server. That delay ultimately led then-FBI Director James Comey to announce – months after essentially exonerating Clinton of criminal wrongdoing and just days before the 2016 presidential election – that the investigation was being reopened.

Read the DOJ Inspector General's full report here.

Looking to establish a frame of mind among the senior FBI agent in Washington who was leading the Clinton-related probe, Horowitz's report cites a cache of text messages between the agent, Peter Strzok, and then-FBI attorney Lisa Page.

"[Trump's] not ever going to become president, right? Right?!" Page wrote to Strzok in August 2016, as disclosed for the first time in Horowitz's report.

Strzok, at the time still leading the FBI probe into Clinton, responded: "No. No he's not. We'll stop it."

Horowitz's report said that message "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. This is antithetical to the core values of the FBI and the Department of Justice."

Horowitz found anti-Trump messages from two other FBI agents and another FBI attorney that his report said "cast a cloud over the FBI's handling" of the Clinton case. In addition, "the damage caused by their actions extends far beyond the scope of the [Clinton] investigation and goes to the heart of the FBI's reputation for neutral factfinding and political independence," the report continued.

But, the report made clear, "our review did not find evidence to connect the political views expressed in these messages to the specific investigative decisions that we reviewed."

For the past year and a half, the inspector general's office has been looking into an array of allegations that the Justice Department and FBI may have allowed political considerations to poison its investigative decisions in the Clinton-related case and other inquiries.

Most controversial was Comey's July 2016 announcement on national TV that Clinton would not face charges because there was no "clear evidence" that she "intended to violate" the law. But, Comey said, the former secretary of state was "extremely careless" in her "handling of very sensitive, highly classified information."

Comey did not consult with the Justice Department at all before making the announcement.

"We found that it was extraordinary and insubordinate for Comey to do so," the inspector general's report released Thursday said. "We concluded that Comey's unilateral announcement was inconsistent with Department policy and violated longstanding Department practice and protocol by, among other things, criticizing Clinton's uncharged conduct."

However, Horowitz said the "judgment calls" made by those investigation Clinton "were not unreasonable," and the ultimate decision not to charge Clinton "was consistent with the Department’s historical approach in prior cases under different leadership, including in the 2008 decision not to prosecute former Attorney General Alberto Gonzales for mishandling classified documents."

In the months after Comey's announcement that Clinton would not face charges, Trump and other Republicans attacked the FBI, with the president accusing the agency of running a "rigged system."

"Crooked Hillary colluded w/FBI and DOJ and media is covering up to protect her," Trump tweeted in October 2016. "Our country deserves better!"

By the time of Comey's public decision in the Clinton matter, Attorney General Loretta Lynch had taken the unusual step of publicly declaring she would accept the FBI's recommendations in the case, after an impromptu meeting with former president Bill Clinton sparked questions about her impartiality.

"Although we found no evidence that Lynch and former President Clinton discussed the [Clinton email] investigation or engaged in other inappropriate discussion during their tarmac meeting, we also found that Lynch's failure to recognize the appearance problem created by former President Clinton's visit and to take action to cut the visit short was an error in judgment," the inspector general's report released Thursday said. "We further concluded that her efforts to respond to the meeting by explaining what her role would be in the investigation going forward created public confusion."

Months after Lynch announced that she would follow the FBI's recommendation, Comey took a step that Clinton insists doomed her campaign. The then-FBI director disclosed in a letter to Congress that the FBI was reopening the Clinton email probe after discovering a trove of potentially relevant emails on the laptop of disgraced congressman Anthony Weiner, whose wife, Human Abedin, was a top aide to Clinton.

It took weeks for the FBI to start analyzing the hundreds of thousands of emails found on the laptop. And although no substantively new emails were identified, the inspector general's office said in its report that previous text messages between Strzok and Page implied "that Strzok might be willing to take official action to impact a presidential candidate's electoral prospects."

Strzok was also in charge of the growing probe tied to Russian interference in the 2016 presidential election and potential efforts to coordinate with associates of Trump.

"Under these circumstances, we did not have confidence that Strzok's decision to prioritize the Russia investigation over following up on the [laptop] lead ... was free from bias," Horowitz's report said.

An attorney representing Strzok, Aitan Goelman, slammed that conclusion, saying in a statement "the report is critically flawed in its bizarre conclusion that the IG cannot rule out 'with confidence' the possibility that Special Agent Strzok’s political 'bias' may have been a cause of the FBI's failure" to review the laptop with more urgency. "In fact, all facts contained in the report lead to the conclusion that the delay was caused by a variety of factors and miscommunications that had nothing to do with Special Agent Strzok’s political views," Goelman said.

Before Comey sent the letter to Congress announcing that new potential evidence had been discovered that the FBI was reopening the Clinton case, a senior Justice Department official told the FBI that Lynch and other senior department officials were opposed to the move, saying that publicizing the bombshell step so close to an election would violate longstanding department policy, and it would ignore federal guidelines prohibiting the disclosure of information related to an ongoing investigation.

Comey, however, sent the letter anyway, insisting he didn't want to conceal information from Congress and that he had an obligation to update lawmakers since he had previously told them the Clinton matter was closed.

"Although we acknowledge that Comey faced a difficult situation with unattractive choices, in proceeding as he did, we concluded that Comey made a serious error of judgment," Horowitz's report said.

Trump decided to fire Comey in May 2017, after Attorney General Jeff Sessions and Deputy Attorney General Rod Rosenstein sent letters to Trump recommending Comey’s dismissal. Trump later indicated the Russia-related probe was also on his mind when he fired Comey.

Shortly after the report was released, Comey tweeted that "the conclusions are reasonable."

Previously, Comey has defended his decisions as director, insisting he was trying to protect the FBI from even further criticism and "didn't see that I had a choice."

"The honest answer is I screwed up a couple of things, but ... I think given what I knew at the time, these were the decisions that were best calculated to preserve the values of the institutions," Comey recently told ABC News. "I still think it was the right thing to do."

Goelman similarly defended his client's decisions, noting he has been a committed public servant for much of his life.

"While pundits and politicians are using this matter to advance their agendas, the truth about Special Agent Strzok's character and professionalism is found in the fact that every witness asked by the [inspector general] said that Strzok's work was never influenced by political views. His dedication to unbiased service is a fact that would be universally echoed by the thousands of people who have worked with Pete during his 26 years of service in the FBI and U.S. Army."