Former top FBI official Andrew McCabe, who was dismissed from the agency following a tumultuous relationship with President Donald Trump, filed a lawsuit on Thursday alleging the termination violated his constitutional rights to free speech and due process.

The lawsuit, filed in federal court in Washington, urged a judge to order the reinstatement of 'his full earned law enforcement pension, healthcare insurance, and other retirement benefits.'

McCabe said in the complaint that his firing was 'unlawful retaliation for his refusal to pledge allegiance' to Trump.

He says that then attorney general Jeff Sessions, himself later fired by Trump, and Christopher Wray, who remains FBI director, engineered his removal because of pressure from the president.

Suing: Andrew McCabe, the fired deputy FBI director, is the latest to go to court to pursue the Trump administration

Top officials: Andrew McCabe says that Jeff Sessions forced him out because he would not 'pledge allegiance' to Donald Trump

Smear campaign? Andrew McCabe says that Trump's months of tweets against him prompted Jeff Sessions and Chris Wray to act unlawfully against him

In legal papers, he said: 'Trump demanded Plaintiff's [McCabe's] personal allegiance, he sought retaliation when Plaintiff refused to give it, and Sessions, Wray, and others served as Trump's personal enforcers rather than the nation's highest law enforcement officials, catering to Trump's unlawful whims instead of honoring their oaths to uphold the Constitution.'

The federal complaint also contends the FBI and Justice Department strayed from established policies, with Wray refusing to tell McCabe why he was being fired and a senior Justice Department lawyer telling McCabe's own lawyer that they were 'making it up as we go along.'

Spokespeople for the FBI and Justice Department declined to comment.

The lawsuit followed a similar one by former high-ranking FBI agent Peter Strzok, who came under fire from Trump and other Republicans for sending text messages that disparaged Trump during the presidential campaign.

McCabe, the law enforcement agency's former No. 2 official, played a crucial role in the bureau´s investigations of Hillary Clinton and Russian interference in the 2016 U.S. election.

Trump and other Republicans accused McCabe, a lifelong Republican who worked at the FBI for more than 20 years, of political bias and conflicts in connection with his oversight of investigations related to Clinton.

McCabe has denied the accusations and charged that he was facing retaliation from the Trump administration.

In his legal papers McCabe alleges that Trump's stream of tweets against him prompted officials to act in loyalty to the president - and against McCabe.

Campaign: Andrew McCabe's wife, Jill McCabe, a Democrat, received donations for an unsuccessful 2015 Virginia state senate campaign from an ally of Clinton's.

Some of the criticism stemmed from the fact that his wife, Jill McCabe, a Democrat, received donations for an unsuccessful 2015 Virginia state senate campaign from an ally of Clinton's.

Former Attorney General Jeff Sessions fired McCabe in March 2018, saying he felt justified in doing so after the Justice Department´s internal watchdog found he leaked information to reporters and misled investigators about his actions.

McCabe had stepped down from his position as FBI deputy director in January 2018 but remained on leave pending retirement.

McCabe has said he believes he was politically targeted because he corroborated former FBI Director James Comey´s claims that Trump tried to pressure Comey into killing the Russia probe.

McCabe was sacked two days before his 50th birthday, when he would have been eligible to retire from the FBI with his full pension.

McCabe published a book in February on the FBI's efforts to safeguard the United States, which argued that Trump undermined the country's security.