Peter Strzok, the former FBI agent who wrote unflattering text messages about President Trump while investigating the Trump campaign’s alleged ties to Russia, has filed a lawsuit against the bureau and the Justice Department – arguing that the FBI caved to the “unrelenting pressure” of the president when it fired him.

“While many in law enforcement have faced attacks by this president, Pete Strzok has been a constant target for two years,” Aitan Goelman, a partner with Zuckerman Spaeder LLP and one of Strzok’s lawyers, said in a statement. “It’s indisputable that his termination was a result of President Trump’s unrelenting retaliatory campaign of false information, attacks and direct appeals to top officials.”

Goelman added: “The lawsuit shows that, in bowing to the president’s desires, FBI leaders trampled Pete’s free speech and due process rights in ways that should be deeply troubling to all in government, and indeed, to all Americans.”

TRUMP VOWS TO UNCOVER RUSSIA PROBE ROOTS WITH DECLASSIFICATION CALL: 'WE'RE EXPOSING EVERYTHING'

The complaint, which names as defendants Attorney General William Barr and FBI Director Chris Wray, revisits a political drama that was seized on by conservative critics of then-Special Counsel Robert Mueller's Russia investigation as proof that the bureau was biased against Trump. Multiple investigations are underway examining whether the FBI acted properly during the Russia investigation, and Strzok remains a target of Trump's scornful tweets.

Representatives of the FBI did not immediately respond to Fox News’ request for comment.

The suit provides new details about the circumstances of Strzok's firing and amounts to the latest defense of his reputation, coming months after a fiery congressional hearing in which he insisted that his personal views never influenced his work.

Strzok, a veteran counterintelligence agent who also helped lead FBI investigations into Hillary Clinton's use of a private email server, was removed from Mueller's team after the texts with FBI lawyer Lisa Page came to light. He was fired from the FBI last August.

GOHMERT UNLOADS ON ‘SMIRKING’ STRZOK: ‘HOW MANY TIMES DID YOU LOOK SO INNOCENT INTO YOUR WIFE’S EYES AND LIE TO HER’

Many of the texts, on FBI cell phones, were bitingly critical of Trump during his 2016 run for office. They were found by the Justice Department's inspector general during its investigation of the FBI's Clinton email probe.

The watchdog office criticized both Strzok and Page, with whom he was having an affair, for their judgment in sending the messages but did not find that the Clinton email investigation was compromised by political bias.

In the lawsuit, Strzok's attorney said the FBI deputy director who fired Strzok was responding to "unrelenting pressure from President Trump and his political allies in Congress and the media."

That deputy, David Bowdich, overruled the recommendation of a disciplinary official that he be merely demoted and suspended without pay and denied him the chance to appeal.

NEW STRZOK-PAGE TEXTS REVEAL OTHERS WERE 'LEAKING LIKE MAD' IN LEAD UP TO TRUMP-RUSSIA PROBE

Bowdich said at the time that Strzok's "sustained pattern of bad judgment in the use of an FBI device" for texting called into question decisions made during the Clinton email investigation and the early stages of the Russia probe. And the FBI has said that Bowdich, as the FBI's No. 2 official, had the authority to overrule disciplinary findings.

The complaint says the campaign to fire Strzok included "constant tweets and other disparaging statements" from Trump, as well as the president's direct appeals to Wray and Barr's predecessor as attorney general, Jeff Sessions, to fire Strzok.

The lawsuit says the administration discriminated against his viewpoint by firing him even though other government officials who have supported Trump in the workplace have kept their job. It notes that the White House has not fired counselor Kellyanne Conway despite the determination that she violated the Hatch Act — a law that limits political activity by government workers — by disparaging Democratic presidential candidates while speaking in her official capacity.

"The Trump administration has consistently tolerated and even encouraged partisan political speech by federal employees, as long as this speech praises President Trump and attacks his political adversaries," the complaint contends.

CLICK HERE FOR THE FOX NEWS APP

The lawsuit also says the Justice Department set out to smear Strzok's reputation and humiliate him when it disclosed nearly 400 text messages he had sent or received.

In the complaint, Strzok also aims to explain some of the texts that have attracted the most negative attention, including one in which he told Page "we'll stop" a Trump presidency.

Conservatives interpreted the text as Strzok saying that he would work to prevent Trump from being elected, but the suit says the message was actually meant to reassure Page that the American people would not support a Trump candidacy.

Fox News’ Bill Mears and The Associated Press contributed to this report.