A highly anticipated US Department of Justice report accuses ex-FBI director James Comey of being "insubordinate" but not politically biased.
Inspector General Michael Horowitz said Mr Comey had broken "dramatically from FBI and department norms" in handling an inquiry into Hillary Clinton's emails.
Mrs Clinton has blamed Mr Comey for her election loss to Donald Trump in 2016.
The report also reveals Mr Comey used a private email account for FBI business.
FBI director Christopher Wray said he accepted the report's findings but he added that nothing in the report pointed towards political bias or impugned the FBI as an institution.
In his report, the inspector general criticised Mr Comey's decision to reveal publicly a week before the election that he had reopened the inquiry into Mrs Clinton's emails, rejecting Mr Comey's argument that he had acted in the interests of transparency.
He found that while Mr Comey's actions were not the result of political bias, "by departing so clearly and dramatically from FBI and department norms, the decisions negatively impacted the perception of the FBI and the department as fair administrators of justice".
The 500-page report also found "a troubling lack of any direct, substantive communication" between Mr Comey and Former Attorney General Loretta Lynch.
But the report also touched on text messages between two FBI officials who later worked on Special Counsel Robert Mueller's investigation into alleged Russian meddling in the US election.
Peter Strzok, who was Mr Mueller's lead agent in the Russian inquiry, was having an affair with Lisa Page, an FBI lawyer who also temporarily worked on the Mueller investigation.
When Ms Page asked if Mr Trump would become president, Mr Strzok responded: "No. No he won't. We'll stop it."
The report called this "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".
Republicans have seized on the messages to argue the FBI investigation was biased against President Donald Trump.
Christopher Wray said employees would be held accountable for any misconduct as a result of the report.
What about Comey's emails?
Potentially embarrassing for the former FBI director is the inspector general's finding that he used a private Gmail address to conduct some official business.
This practice continued while he was investigating Mrs Clinton for using a private email account to handle government secrets - which at the time Mr Comey branded "extremely careless".
When asked about his own email by investigators, Mr Comey said: "I had the sense that it was OK."
He said he only handled non-confidential information on his Gmail, and it was only used for information that would become public anyway, such as speeches or public statements.
But the inspector general said it was "inconsistent" with justice department policy.
Mrs Clinton took to Twitter to make a sarcastic comment.
Fuel for partisan fires
Analysis by Anthony Zurcher, BBC News
James Comey deviated from FBI policy in his handling of the FBI investigation into Hillary Clinton's private email server.
This isn't exactly news. In fact, it's something both Democrats and Republicans agree on - although for very different reasons.
Now the inspector general has weighed in, and while he says that it was reasonable for Mr Comey to decide not to charge Hillary Clinton with mishandling classified information, the way he went about announcing that was improper.
What's more, his letter to Congress on the eve of the presidential election represented a "serious error of judgement".
All of this will have Mrs Clinton's supporters nodding in agreement.
Where the matter gets more complicated, however, is in evidence of anti-Trump sentiment the inspector general exposed within the FBI.
While he concluded that it did not bias the investigation into Mrs Clinton, the effect on the Trump-Russia inquiry was not within the inspector general's mandate.
Expect the president and his supporters to amplify Peter Strzok's text message that "we'll stop" Mr Trump from becoming president and point to the inspector general's finding that he may have been biased in prioritising the Trump investigation over the Clinton one in the last month of the presidential campaign.
In the end, the inspector general report will provide fuel for partisan fires on both sides - and it will be very difficult to keep the flames from spreading to Robert Mueller's ongoing special counsel investigation.
Why was there a report?
In announcing the review in January 2017, Mr Horowitz said there was overwhelming demand from lawmakers, members of the public, and "various organisations" to investigate claims of unprofessional behaviour on the part of the justice department and FBI employees.
President Trump is among the most vocal critics of the FBI and the Department of Justice, repeatedly accusing several employees of being biased against him.
The report focuses on Mr Comey's decision in July 2016, when FBI director, to hold a news conference announcing that Mrs Clinton would not be criminally charged for using a private email server for classified information during her time as US secretary of state.
Eleven days before the presidential election, Mr Comey announced that the bureau was investigating new emails related to the Clinton email inquiry.
The inspector general's report calls that decision a "serious error in judgment".
Mrs Clinton and her aides blamed Mr Comey for her subsequent defeat while Democrats pointed out that he remained silent at the time about an investigation into possible collusion between Russia and the Trump campaign.
Mr Trump's decision to fire Mr Comey in May 2017 led the Department of Justice to appoint Mr Mueller, an ex-FBI director, to open an investigation into the Russia allegations.
Mr Trump has repeatedly denied any collusion with the Kremlin, calling the Russia investigation a "witch hunt".
How has Comey reacted?
On Twitter and in a New York Times op-ed, he said he had no regrets about his handling of the Clinton investigation.
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.— James Comey (@Comey) June 14, 2018
Former Attorney General Loretta Lynch released a statement outlining how the report upheld her "fidelity to the rule of law", making no mention of any of the criticism it levelled at her.
The president, meanwhile, took to Twitter to brand allegations of Russian collusion as "phony" and "garbage".
Now that I am back from Singapore, where we had a great result with respect to North Korea, the thought process must sadly go back to the Witch Hunt, always remembering that there was No Collusion and No Obstruction of the fabricated No Crime.— Donald J. Trump (@realDonaldTrump) June 14, 2018
So, the Democrats make up a phony crime, Collusion with the Russians, pay a fortune to make the crime sound real, illegally leak (Comey) classified information so that a Special Councel will be appointed, and then Collude to make this pile of garbage take on life in Fake News!— Donald J. Trump (@realDonaldTrump) June 14, 2018
On Friday morning, Mr Trump told Fox News that "Comey was the ring leader of a den of thieves".
"What he did was criminal, terrible in terms of the constitution and horrible," Mr Trump said.
He added, however, that he "would never want to get involved in whether Comey should be locked up".