Former FBI Deputy Director Andrew McCabe sued the Justice Department and the FBI Thursday over his dismissal from the bureau last year, arguing that the agencies bowed to political pressure from President Trump.

The lawsuit accuses President Trump of scheming to "discredit and remove DOJ and FBI employees who were deemed to be his partisan opponents because they were not politically loyal to him" and claims former Attorney General Jeff Sessions and current FBI Director Christopher Wray created a pretext to force him out in accordance with the president's wishes.

"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 lawsuit says.

Sessions fired McCabe on March 16, 2018, after a Justice Department inspector general report found he had repeatedly misstated his involvement in a leak to The Wall Street Journal regarding an FBI investigation into the Clinton Foundation. The watchdog office referred the matter to the U.S. Attorney's Office in Washington, which has been investigating.

FBI EMPLOYEES DISCIPLINED FOR UNAUTHORIZED DISCLOSURES RECEIVED LIGHTER PUNISHMENTS AFTER INTERNAL REVIEW, DOCS SHOW

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."

McCabe has denied any wrongdoing and said that when he felt his answers were being misunderstood, he tried to correct them. He was terminated after 21 years of service and only 26 hours before his planned retirement date.

CLICK HERE TO GET THE FOX NEWS APP

The lawsuit by McCabe was filed two days after former FBI agent Peter Strzok, who wrote anti-Trump text messages while investigating the Republican campaign's alleged ties to Russia, filed a lawsuit arguing that the FBI caved to the "unrelenting pressure" of the president when it fired him.

Fox News' Jake Gibson, Andrew O'Reilly, and Brooke Singman and The Associated Press contributed to this report.