Josh Campbell is a CNN analyst, providing insight on national security, crime, justice issues. He previously served as a Supervisory Special Agent with the FBI, special assistant to the bureau's director, and is currently writing a book on recent attempts by elected officials to undermine the rule of law. Follow him on Twitter at @joshscampbell . The views expressed in this commentary are his own. View more opinion articles on CNN.

(CNN) President Donald Trump is taking a victory lap, following the firing of embattled FBI Deputy Assistant Director Peter Strzok. But Trump likely doesn't realize he's doing himself more harm than good, considering that each presidential tweet is cataloged as potential evidence in a future lawsuit.

On Monday, it was reported that Strzok had been fired from the agency following an exhaustive review of his actions during, and in the aftermath of, the 2016 presidential election. The decision stemmed from the revelation of a trove of highly questionable text messages between Strzok and Lisa Page, a former FBI lawyer with whom Strzok was having an extramarital affair.

The communications in question cast Strzok, and indeed the entire FBI, in a terrible light, with some questioning whether politics had played a role in the bureau's case involving former Secretary of State Hillary Clinton, and its subsequent investigation of potential ties between the Trump campaign and the government of Russia.

Although Strzok and Page's text messages reveal their personal contempt for a number of government officials, it is their criticism of Trump that has caused the agency the most damage and has cast doubt on the FBI's reputation as an honest, independent and apolitical workforce.

In one explosive exchange just prior to the 2016 election, Page texted about her concern that Trump might actually win the presidency. "No, no he won't. We'll stop it," Strzok replied.

Following an exhaustive review of the actions of FBI officials, the independent Justice Department Office of Inspector General recently concluded that, although Strzok's bias against Trump may have affected his impartiality, there was no evidence that politics had actually impacted the bureau's investigation.

Nevertheless, Trump and his allies have seized on Strzok's actions as "evidence" that dark forces within the Department of Justice are actively working to subvert his authority and take him down. They have amplified missteps by those leading the investigation into the actions of his campaign and have twisted facts in order to portray America's institutions of justice as systematically and improperly aligned against him. This entire effort has been part of a long-running campaign to undermine the credibility of the ongoing probe by Special Counsel Robert Mueller, in order to discredit its eventual findings.

Following the announcement of Strzok's firing, the President opened the latest front in his public relations assault on the rule of law, wasting no time taking to Twitter and again lambasting the FBI and Mueller's investigation. Trump insists that because Strzok worked for a short period of time on the Mueller team, the entire investigation is now suspect and corrupt. He has also called for a new investigation into Clinton, since Strzok also previously worked on that case.

The President continually and viciously attacking a career civil servant like Strzok has only provided Strzok with evidence to show the deck was stacked against him from the start. How can one expect a fair hearing when the commander in chief -- the head of the executive branch who also oversees the FBI -- has led the charge in prematurely exclaiming one's guilt?

What Trump should have done is stay silent on the issue and permitted the independent internal affairs process to unfold without undue influence. Doing so would have limited Strzok's ability to prove he was singled out for harassment by those in power.

However, Strzok's firing likely had nothing to do with the nonsensical idea that he led a secret effort to take down Trump. Those inside the FBI don't wake up each morning taking direction from presidential tweets. Instead, Strzok was probably terminated because he exercised poor judgment, proved himself an ineffective leader and caused great damage to the FBI's image as an institution above politics.

Follow CNN Opinion Join us on Twitter and Facebook

The seriousness with which the bureau took the allegations is underscored by the fact an FBI internal affairs review of Strzok's actions recommended he be suspended, yet FBI leadership overruled that recommendation and moved for termination.

His reputation inside the bureau may have been that of an excellent counterintelligence investigator, but FBI executives had to weigh his past investigative performance against recent misconduct, and likely determined he could no longer effectively serve the organization. How could they expect rigorous obedience to the agency's core values by the rank and file, while at the same time giving a senior leader like Strzok a pass on serious lapses in judgment?

Although Strzok is now out, he stands to benefit from Trump's unprecedented assault. While streams of consciousness on Twitter and calculated blows aimed at undermining the Mueller probe may be cathartic for the President, he is making it extremely easy for Strzok to claim he was treated unfairly.