The FBI agent who wrote derogatory text messages to his lover about Donald Trump filed a lawsuit Tuesday charging that the bureau caved to 'unrelenting pressure' from the president when it fired him.

The suit from Peter Strzok also alleges he was unfairly punished for expressing his political opinions, and that the Justice Department violated his privacy when it shared hundreds of his text messages with reporters.

Among those texts were message he sent to his lover, FBI attorney Lisa Page, which said 'F TRUMP,' called the then-presidential candidate 'awful' and said of his campaign to win the election: 'We'll stop it.'

But he is now demanding his job back and calling his ouster a smear campaign which breached his privacy and made him subject to death threats.

'The campaign to publicly vilify Special Agent Strzok contributed to the FBI's ultimate decision to unlawfully terminate him,' the lawsuit says, 'as well as to frequent incidents of public and online harassment and threats of violence to Strzok and his family that began when the texts were first disclosed to the media and continue to this day.'

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 special counsel Robert Mueller's Russia investigation as proof that the bureau was biased against Trump.

Suing: Peter Strzok, who gave evidence to the House Judiciary Committee in July 2018, has lodged legal papers demanding his job back and saying he was the victim of a political vendetta

Exchanges: Peter Strzok and his lover Lisa Page, and FBI attorney, exchanged months of anti-Trump texts while they worked on investigation into Hillary Clinton's secret server, and then the Russia inquiry

How Trump hit out at Strzok: This is one of the tweets which Peter Strzok says is evidence the FBI succumbed to a political vendetta by firing him

Multiple investigations are underway examining whether the FBI acted properly during the Russia investigation, and Strzok remains a frequent target of Trump's scornful tweets.

F TRUMP, HE'S A D****E AND WE WILL STOP HIM: THE EXPLOSIVE FBI LOVERS' TEXT Strzok to Page: God that's a great article. Thanks for sharing. And F TRUMP. Strzok to Page: Just went to a Southern Virginia Walmart. I could SMELL the Trump support. Page to Strzok: Trump’s not ever going to become president, right? Strzok replies: No. No, he won’t. We’ll stop it. Page to Strzok: God trump is a loathsome human. Strzok replied: Yet he many win. Good for Hillary.' Page to Strzok: omg he’s an idiot. Strzok replied: He's awful. Strzok to Page: God Hillary should win. 100,000,000-0. Strzok to Page [during Republican national convention]: Oooh, TURN IT ON, TURN IT ON!!! THE DOUCHEBAGS ARE ABOUT TO COME OUT. You can tell by the excitable clapping. Page: My god, I’m so embarrassed for them. These are like second-run stars. Nothing the B-list to relate to the kids these days. Page: And wow, Donald Trump is in an enormous douche. Strzok to Page [during Trump-Clinton debate]: I am riled up. Trump is a f***ing idiot, is unable to provide a coherent answer. Strzok: I CAN'T PULL AWAY, WHAT THE F**K HAPPENED TO OUR COUNTRY (REDACTED)??!?! Page: I don't know. But we'll get it back. We're America. We rock. Advertisement

The lawsuit seeks reinstatement to the FBI, back pay and a declaration that the government violated his rights.

A Justice Department spokeswoman declined to comment, and representatives of the FBI did not immediately respond to a request seeking comment.

'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,' Aitan Goelman, a lawyer for Strzok, 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,' Goelman added.

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 helped lead FBI investigations into Hillary Clinton's use of a private email server and ties between the Trump campaign and Russia, 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; Page had resigned in May.

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 attorney Goelman says the FBI deputy director who fired him 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.

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.

Double standard: Peter Strzok's attorneys say he was fired for being anti-Trump by Kellyanne Conway, a counselor to the president, was unpunished for a breach of the Hatch Act

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.

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.