A Justice Department watchdog on Thursday criticized former FBI Director James Comey for violating long-standing department guidelines and mishandling the Hillary Clinton email investigation in 2016.

The probe by Inspector General Michael E. Horowitz has already prompted reassignments and departures at the highest levels of the FBI. Former Deputy Director Andrew McCabe abruptly left the bureau in January, as watchdogs raced to finish their report, and later was fired outright.

Asked about the report at the daily White House briefing, press secretary Sarah Sanders said, "The president was briefed on the IG report earlier today, and it reaffirmed the president's suspicions about Comey's conduct and the political bias amongst some of the members of the FBI."

Speaking recently to reporters, Trump suggested the inspector general's findings could be something of a "birthday present" for him. Trump turns 72 on Thursday.

Comey wasn't the only person whose conduct has undercut public faith in the Justice Department, the report found.

For example, two FBI officials, special agent Peter Strzok and lawyer Lisa Page, also have been under intense scrutiny after their text messages were collected during the inspector general investigation and later released to Congress and the public.

Page has left the FBI. The disclosures about the range of candid political and other opinions that Page traded with Strzok on their official government mobile phones has been an embarrassment for the bureau.

In one new message released on Thursday, Page writes to Strzok:

Page - (Trump's) not ever going to become president right? Right?!

Strzok: No. No he's not. We'll stop it.

The FBI officials did not "stop" Trump from being elected, but Trump and Republicans have cited those kinds of statements in months of attacks on federal law enforcement. "Biased" officials in what they call the "deep state" are trying to frame Trump in another investigation, they contend — the one by special counsel Robert Mueller into the Russian attack on the 2016 election.

Trump and his Republican allies also have accused then-Attorney General Loretta Lynch and other officials in the Obama administration of being too soft on Clinton. "Lock her up" was a campaign rally leitmotif in 2016 and remains a popular chant at the president's campaign events now.

But, like Comey, Lynch seized on the finding of no political bias, saying in a statement Thursday evening that the report "outlines how I, along with the career prosecutors I oversaw at DOJ, did everything we could to handle a sensitive probe in a highly politicized environment in a way that was non-partisan, impartial, and fair." She added, "I stand behind our collective effort to preserve the integrity and impartiality of the institution during a challenging moment in our nation's history."

Dems: The feds didn't go easy on Hillary. They hurt her

Democrats, meanwhile, said the findings of the report made it clear that the FBI had effectively helped elect Trump — by damaging Clinton.

For example, the minority leaders of the House Judiciary and Oversight committees cited Comey's choice to reveal the FBI's investigation into Clinton but not its counterintelligence investigation into Trump aides' ties to Russians.

"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," said Judiciary Committee ranking member Jerry Nadler of New York and Oversight Committee ranking member Elijah Cummings of Maryland.

The Democrats also said they are angry that Comey talked so much, so often, about a case that he ultimately had concluded should not result in any prosecution.

"The FBI should not have spoken publicly about the case after recommending against criminal charges," Nadler and Cummings said. "They should not have revealed that they had reopened the case just days before the election. These actions violate long-standing guidelines designed to protect citizens from unfair attacks and avoid influencing elections."

Justice, FBI vow to do better

Attorney General Jeff Sessions — whom Trump has said he regrets nominating — said on Thursday that he views the "errors" uncovered by IG report as an opening the Justice Department can use to improve itself.

"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. "The department is not above criticism, and it is accountable to the chief executive, Congress, and most importantly, the American people."

FBI Director Christopher Wray, whom Trump nominated to replace Comey after an interregnum in which McCabe was acting director, picked up that theme from Sessions.

"The FBI is taking immediate remedial actions to reinforce the importance of maintaining a work environment free from the appearance of political bias," he said in a written response to the inspector general. Wray also said the actions include a review of whether commingling of work discussions and political commentary violates any FBI guidelines and "a review of how the FBI staffs, structures and supervises sensitive investigations."

But in a news conference Thursday evening, Wray seemed to push back at the persistent attacks on the FBI's reputation in recent months by the president and some in Congress. Asked about those critics and the bureau's reputation, Wray said, "There's no shortage of opinions about us out there. I will tell you that the opinions that I care the most about are the opinions of the people who actually really know us and know us through our work."

Those faulted in the report fire back

Comey has defended his actions in 2016 as the response to an unprecedented situation for which there was no instruction manual. He said on Twitter after the release of the IG report that he welcomed the work that investigators have now completed.

Comey also pointed out in a column in The New York Times that Horowitz's report had effectively vindicated his decision-making — that there was no "prosecutable" case against Clinton.

Others defended themselves on Thursday, too.

McCabe, who faces potential criminal charges, did not comment on the report, but his attorney Michael Bromwich issued a statement defending him.

"In short, the report demonstrates that any and all claims that political bias or political influence affected Mr. McCabe's actions, including charges from the president and other critics, are entirely baseless," Bromwich said.

A lawyer for Strzok, Aitan Goelman, pointed to a section that said there is no evidence that the political views Strzok expressed "impacted the handling of the Clinton email investigation."

Moreover, Goelman said, the IG report noted instances in which Strzok and Page supported investigative techniques even more aggressive than those supported by their bosses, including the potential use of search warrants or a grand jury to get witnesses' testimony and issue subpoenas.

And David Laufman, the former Justice Department counterintelligence official who oversaw the Clinton email probe, defended the integrity of the investigation amid repeated attacks from the president and his allies.

"Particularly given the formidable circumstances, the Justice Department lawyers who conducted this investigation carried out their responsibilities with exceptional rigor, professionalism and integrity consistent with the finest traditions of the department," he said.

The Clinton matter

The IG report has its origins in the tumultuous days after the 2016 presidential election, when politicians and Justice Department veterans of all stripes cried foul at the FBI's public statements about its investigation of Clinton's email practices.

Clinton used a private email server while she served as secretary of state under President Barack Obama. Although she said she regretted the practice, Clinton said she never knowingly used it to handle classified information. Republicans alleged that she knowingly hazarded important secrets and received sympathetic treatment from then-Attorney General Lynch.

Thursday's IG report faulted Lynch for not being more sensitive to the public perceptions she created by meeting privately with former President Bill Clinton aboard an airplane as the FBI investigation was taking place.

"Lynch's failure to recognize the appearance problem created by former President Bill Clinton's visit and to take action to cut the visit short was an error in judgment," the report said. Her statements later about her decision not to recuse "created public confusion and didn't adequately address the situation."

"Although we did not find clear evidence that Secretary Clinton or her colleagues intended to violate laws governing the handling of classified information, there is evidence that they were extremely careless in their handling of very sensitive, highly classified information," Comey told reporters at the time.

"In this case, given the importance of the matter, I think unusual transparency is in order," he also said.

Comey eventually appeared before lawmakers to explain his findings and promised to update them if any new information came to light.

The FBI director notified Congress he had reopened the probe Oct. 28, 2016, because of emails that investigators had found on the laptop belonging to Anthony Weiner, the then-husband of longtime Clinton confidante and aide Huma Abedin.

And then, just days before the election, Comey went public again, to tell lawmakers he had found no new bombshells and would again close the investigation with no charges — on Nov. 6.

Clinton and her top aides blamed Comey's verbosity for slowing her momentum in the waning days of the campaign and turning the election for her opponent, Donald Trump.

"I was on the way to winning until the combination of Jim Comey's letter on Oct. 28 and Russian WikiLeaks raised doubts in the minds of people who were inclined to vote for me but got scared off," she later said.

Comey, of course, was fired by Trump in May 2017, a move that helped prompt the Justice Department to appoint special counsel Robert Mueller to investigate Russian election interference and whether any Americans took part.

In a book published this year, Comey defended himself as caught in a "500-year flood," and he concluded he would probably take the same actions that drew so much criticism of himself and the FBI.

The other subjects under investigation by the inspector general included:

Whether Deputy FBI Director McCabe should have been recused from participating in the Clinton matter because his wife took donations from Clinton's friend Terry McAuliffe in her unsuccessful run for the Virginia state Legislature.

Whether the Justice Department's former top lobbyist improperly shared information with the Clinton campaign or should have been recused because of his friendship with campaign chairman John Podesta.

Whether any other DOJ or FBI employees disclosed nonpublic information about the email investigation.

Whether the FBI release of some Freedom of Information Act documents in late October and early November 2016 was influenced by improper political considerations.

Prior to the report's release Thursday, Horowitz established some limits about what he would conclude in it.

"The review will not substitute the OIG's judgment for the judgments made by the FBI or the Department regarding the substantive merits of investigative or prosecutive decisions," the inspector general pledged in January 2017 when he launched the probe.

In other words, although the IG report faulted Comey and others, it did not second-guess their decisions not to press criminal charges against Clinton.

Horowitz, a former federal prosecutor who worked under both Democrats and Republicans, has drawn bipartisan support over his career. But he was the subject of a tweet from Trump in February that called him "an Obama guy."