WASHINGTON — Former FBI Deputy Director Andrew McCabe sued the Department of Justice and the FBI Thursday over his March 2018 firing, arguing that it was a political move at the hands of President Trump.

McCabe’s ouster came less than two days before his 50th birthday — when he was planning to retire and would have been eligible for full pension benefits.

McCabe was briefly head of the FBI in the days following the president’s decision to fire FBI Director James Comey in May 2017, prompting then Deputy Attorney General Rod Rosenstein to tap Special Counsel Robert Mueller to take over the bureau’s investigation into Russia’s meddling in the 2016 election and any contacts Russians may have had with the Trump campaign.

As part of his criticism of the Russia investigation, the president used McCabe as an example of political bias within the institution, noting how McCabe’s wife had run for elected office as a Democrat, and took donations from a political action committee associated with former Virginia Gov. Terry McAuliffe, a close political ally of Bill and Hillary Clinton.

“Why didn’t A.G. Sessions replace Acting FBI Director Andrew McCabe, a Comey friend who was in charge of Clinton investigation but go big dollars ($700,000) for his wife’s political run from Hillary Clinton and her representatives. Drain the Swamp!” Trump tweeted back in July 2017.

Trump continued the onslaught for almost a year and cheered McCabe’s firing. It had been justified by an internal review by Justice Department Inspector General Michael Horowitz, alleging McCabe misled investigators about his role permitting FBI officials to speak to the press.

As defendants the lawsuit lists current Attorney General William Barr, the Department of Justice and FBI Director Christopher Wray, who took over after McCabe.

But it’s Trump who gets the blame in McCabe’s suit, filed in federal court in Washington, DC.

“Trump, acting in an official capacity of President of the United States, is responsible and accountable for Defendants’ actions,” the lawsuit said.

“Trump purposely and intentionally caused the unlawful actions of Defendants and other Executive Branch subordinates that led to Plaintiff’s demotion and purported termination.”