The FBI agent whose anti-Trump text messages got him removed from the investigation into Russia’s election interference and ultimately fired from the bureau asked in a lawsuit Tuesday to be reinstated and awarded back pay, arguing he was unfairly terminated for criticizing the president.

Peter Strzok asserted in the suit that the Trump administration had “consistently tolerated and even encouraged partisan political speech by federal employees” — but only if that speech praised the president and attacked his opponents. The former FBI agent who President Trump has attacked repeatedly alleged that his removal was “part of a broader campaign against the very principle of free speech,” which he said was “initiated and led by” the commander in chief.

“It’s indisputable that his termination was a result of Trump’s unrelenting retaliatory campaign of false information, attacks and direct appeals to top officials,” Aitan Goelman, Strzok’s lawyer, said in a statement. “Today, Pete Strzok is fighting back, and sending a message that the Administration’s purposeful disregard for constitutional rights must not be tolerated.”

Strzok, who joined the FBI in 1996 as an analyst on terrorism cases, was once one of the bureau’s go-to agents for espionage and counterintelligence work, and he was a key figure in both the investigation into Hillary Clinton’s use of a private email server while she was secretary of state and the inquiry into whether the Trump campaign had coordinated with Russia to influence the 2016 election.

But in the course of that work, Strzok began exchanging politically charged text messages with an FBI lawyer, Lisa Page, with whom he was having an affair. The messages, sent on work phones, were critical of numerous politicians, but none more so than Trump, who Strzok derided as “abysmal” and a “disaster.”

In August 2016, after Page wrote Trump was “not ever going to become president, right? Right?!” Strzok responded: “No. No he’s not. We’ll stop it.”

The Justice Department inspector general found that message “implies a willingness to take official action to impact the presidential candidate’s electoral prospects.” Strzok, who had been assigned to work with special counsel Robert S. Mueller III, was removed from the Russia investigation when the messages were discovered, and in August 2018, he was fired from the FBI.

The FBI had first proposed firing Strzok a few months earlier, writing in a notice that the messages would “be the subject of damning public discourse for days, months, and even years to come, and the FBI will be recipient of the expressed outrage.”

But FBI Assistant Director Candice Will, who runs the bureau’s Office of Professional Responsibility, ultimately determined Strzok should be demoted and suspended for 60 days, according to the suit. She was overruled by FBI Deputy Director David Bowdich, who determined that Strzok’s “sustained pattern of bad judgment in the use of an FBI device” had called into question the FBI’s decisions in the Russia and Clinton email investigations, according to the suit.

Strzok alleged in the suit that others in the bureau had not received similar discipline for criticism of Clinton, and he claimed Bowdich’s decision was the “direct result of unrelenting pressure from President Trump and his political allies on Capitol Hill.” Trump had repeatedly attacked Strzok publicly and privately and called for his firing.

Strzok asserted in the suit that his sentiments were “protected political speech,” and that his termination violated the First Amendment. He conceded that while the Hatch Act restricts the political activities of some employees, he had not violated even that law, and noted that Trump had rejected a recommendation to fire a senior White House adviser, Kellyanne Conway, for her violations of the Hatch Act.

Strzok alleged in the suit that the Justice Department had violated the Privacy Act in releasing his and Page’s texts, and violated his Fifth Amendment rights in not allowing him to appeal Bowdich’s decision to a disciplinary review board.

The suit was filed in federal court in the District of Columbia.

Justice Department and FBI spokeswomen declined to comment.