Former FBI agent Peter Strzok sued the Department of Justice and FBI on Tuesday, alleging his firing last year was politically motivated and a violation of his constitutional rights.

Strzok accused the FBI deputy director who fired him of responding to "unrelenting pressure from President Trump and his political allies in Congress and the media."

The lawsuit also contrasts Strzok's treatment with the way the White House handled controversy surrounding Trump loyalists like Kellyanne Conway.

A federal watchdog determined in June that Conway repeatedly violated the Hatch Act in her capacity as a government employee and that she was a "repeat offender" who has shown "disregard for the law."

"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," Strzok's lawsuit says.

Visit Business Insider's homepage for more stories.

The former FBI agent Peter Strzok sued the Justice Department and the FBI on Tuesday for firing him last year, alleging the move was politically motivated and a violation of his constitutional rights.

"The campaign to publicly vilify Special Agent Strzok contributed to the FBI's ultimate decision to unlawfully terminate him, 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 suit alleges.

The lawsuit names Attorney General William Barr and FBI Director Christopher Wray as the defendants.

Strzok and the FBI lawyer Lisa Page became the center of Republican attacks on the FBI's Russia investigation when text messages that they exchanged excoriating President Donald Trump were publicly released in December 2017.

At the time they were sending the text messages, Strzok and Page were working on the Russia investigation with then-special counsel Robert Mueller. Mueller dismissed Strzok from his team when the texts emerged, and Strzok was fired in August 2018.

Read more: 'A f---ing travesty': Justice Department veterans say the way Mueller's testimony was handled blew past the 'historical significance of this moment'

In his lawsuit, Strzok alleges that the DOJ and FBI violated his First and Fifth Amendment rights by firing him for expressing his political views and depriving him of the right to due process to challenge his ouster. He also alleges the DOJ's controversial decision to release his texts to the media before turning them over to Congress was a "deliberate and unlawful" violation of the Privacy Act.

Strzok also accused the FBI deputy director who fired him of responding to "unrelenting pressure from President Trump and his political allies in Congress and the media."

Strzok was referring to the decision by that official, David Bowdich, to fire him despite the FBI's Office of Professional Responsibility's recommendation that Strzok merely be demoted and suspended without pay. Bowdich's ruling also denied Strzok the opportunity to appeal his dismissal.

Strzok's lawsuit also alleges that Trump's push to have him removed included "constant tweets and other disparaging statements," as well as the president's repeated requests to both Wray and then-Attorney General Jeff Sessions to fire Strzok.

Read more: The Senate Intelligence Committee just released the first volume of its final report on Russian interference in the 2016 US election

Trump often invokes Strzok and Page's text exchanges to discredit the Mueller investigation and the FBI, frequently calling for investigations into "the FBI lovers" and other officials, including former FBI Deputy Director Andrew McCabe, who was forced out in March 2018.

Among the messages that drew the most ire from Republicans was an August 8, 2016, exchange in which Page questioned whether Trump could be elected president, to which Strzok responded: "No. No he's not. We'll stop it."

Strzok's lawsuit contrasts his firing with the way the White House handled controversy stoked by the counselor to the president Kellyanne Conway.

The US Office of Special Counsel (OSC) determined in June that Conway repeatedly violated the Hatch Act in her capacity as a government employee. The OSC said Conway was a "repeat offender" who has shown "disregard for the law."

But the White House stood by Conway and said the agency's decision was "influenced by media pressure and liberal organizations — and perhaps OSC should be mindful of its own mandate to act in a fair, impartial, non-political manner, and not misinterpret or weaponize the Hatch Act."

"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," Strzok's lawsuit says.