The FBI has fired Agent Peter Strzok, who helped lead the bureau’s investigation into Russian interference in the 2016 election until officials discovered he had been sending anti-Trump texts.

Aitan Goelman, Strzok’s lawyer, said FBI Deputy Director David L. Bowdich ordered the firing on Friday — even though the director of the FBI office that normally handles employee discipline had decided Strzok should face only a demotion and 60-day suspension. Goelman said the move undercuts the FBI’s repeated assurances that Strzok would be afforded the normal disciplinary process.

“This isn’t the normal process in any way more than name,” Goelman said.

The FBI declined to comment.

The termination marks a remarkable downfall for Strzok, a 22-year veteran of the bureau who investigated Russian spies, defense officials accused of selling secrets to China and myriad other important cases. In the twilight of his career, Strzok was integral to two of the bureau’s most high-profile investigations: the Russia case, and the investigation into Hillary Clinton’s use of a private email server while secretary of state.

But when a Justice Department inspector general investigation uncovered politically charged messages that Strzok had exchanged with another FBI official, he was relegated to a position in human resources. Conservatives soon made Strzok the face of their attacks against the special counsel investigation into the president’s campaign, and the FBI took steps to remove him from its ranks.

[FBI agent Peter Strzok feuds with GOP critics at hearing]

Strzok’s position in the bureau had been precarious since last summer, when Inspector General Michael E. Horowitz told Special Counsel Robert S. Mueller III that the lead agent on his team had been exchanging anti-Trump messages with an FBI lawyer. The next day, Mueller expelled Strzok from the group.

The lawyer, Lisa Page, had also been a part of Mueller’s team, though she left a few weeks earlier and no longer works for the FBI. She and Strzok were having an affair.

President Trump has derided the pair as “FBI lovers,” and he and his conservative allies have pointed to their conduct in an attempt to discredit the Mueller probe. As recently as Saturday, Trump tweeted an attack on Strzok, Page and former FBI director James B. Comey and deputy director Andrew McCabe.

“Will the FBI ever recover it’s once stellar reputation, so badly damaged by Comey, McCabe, Peter S and his lover, the lovely Lisa Page, and other top officials now dismissed or fired?” Trump wrote. “So many of the great men and women of the FBI have been hurt by these clowns and losers!”

Horowitz concluded that Strzok showed a “willingness to take official action” to hurt Trump’s electoral prospects, particularly in a text he sent telling Page “we’ll stop” Trump from being president.

Strzok, who was a deputy assistant director for counterintelligence at the bureau, has apologized for sending the messages and said they reflected personal views that did not affect his work. His lawyer has said that had Strzok wanted to prevent Trump’s election, he could have leaked that Trump’s campaign was under investigation for possibly coordinating with Russia — a revelation that might have upended his bid to become president.

At a Congressional hearing earlier this month, Strzok sparred with Republican lawmakers who raised questions about his character and even his marriage. He asserted there was “no evidence of bias in my professional actions” and that his having to testify was “just another victory notch in [Russian President Vladimir] Putin’s belt and another milestone in our enemies’ campaign to tear America apart.”

Strzok was escorted out of the FBI building in June and effectively relieved of work responsibilities, though he technically remained an FBI employee as he and his attorney challenged the effort to dismiss him. On July 24, they made a final pitch to Candice M. Will, who leads the FBI’s Office of Professional Responsibility.

Goelman said Will ultimately decided that Strzok face a demotion and 60-day suspension and be subjected to a “last chance agreement.” That would have put him on thin ice if he were commit another offense. But Goelman said Bowdich overruled that decision and ordered Strzok’s termination.

During a June congressional hearing, FBI Director Christopher A. Wray said Strzok had been referred to the Office of Professional Responsibility — which he referred to as the bureau’s “independent disciplinary arm” — and that officials would “not hesitate to hold people strictly accountable.” Wray promised that process would be “done by the book.”

Strzok is the third high-ranking FBI official involved in the Clinton and Russia investigations to be fired amid an intensely political backdrop. Trump removed Comey as the bureau’s director and said he did so thinking of the Russia case. Attorney General Jeff Sessions later removed Comey’s deputy, McCabe, after the inspector general alleged he lied about a media disclosure related to Clinton.

McCabe — who, unlike Comey, could not be removed at the will of the president — has said his termination was a politically motivated attempt to undermine the Mueller probe. He is currently facing a criminal investigation by prosecutors in the D.C. U.S. Attorney’s Office.

It is possible that others could yet face discipline. The inspector general identified five FBI employees, including Strzok and Page, with some connection to the Clinton email case who had exchanged messages expressing hostility toward Trump, support for Clinton or other political views. Each was referred to the FBI for possible violations of the bureau’s code of conduct.