WASHINGTON — Attorney General Jeff Sessions announced Friday night that he was firing former FBI Deputy Director Andrew McCabe, a longtime and frequent target of President Donald Trump’s anger, just two days before his scheduled retirement date.

The move, which had been expected, was made on the recommendation of FBI disciplinary officials and comes ahead of an inspector general report expected to conclude that McCabe was not forthcoming with the watchdog office as it reviewed the bureau’s handling of the Hillary Clinton email investigation.

Sessions said in a statement that investigators “concluded that Mr. McCabe had made an unauthorized disclosure to the news media and lacked candor — including under oath — on multiple occasions.”

McCabe immediately disputed the findings in his own statement, saying the firing was part of a Trump administration “war” on the FBI.

“I am being singled out and treated this way because of the role I played, the actions I took, and the events I witnessed in the aftermath of the firing of James Comey,” McCabe said, referring to the former FBI director who was fired by Trump last May.

Though McCabe had spent more than 20 years as a career FBI official, and had played key roles in some of the bureau’s most recent significant investigations, Trump repeatedly condemned him over the last year as emblematic of an FBI leadership he contends is biased against his administration. The White House had said the firing decision was up to the Justice Department but seemed to signal this week that it would welcome the move.

The termination is symbolic to an extent, since McCabe had been on leave from the FBI since last January, when he abruptly left the deputy director position. But it comes just ahead of his planned retirement, on Sunday, and puts his ability to receive pension benefits into jeopardy.

McCabe came under scrutiny from the Justice Department’s inspector general’s office over an October 2016 news report that revealed differing approaches within the FBI and Justice Department over how aggressively the Clinton Foundation should be investigated. The watchdog office had concluded that McCabe had authorized FBI officials to speak to a Wall Street Journal reporter for that story and that he had not been forthcoming with investigators about that — something McCabe denies, according to one person familiar with the matter.

Officials at the FBI’s Office of Professional Responsibility had recommended the firing, leaving Justice Department leaders in a difficult situation. Sessions, whose job status has for months appeared shaky under blistering criticism from Trump, risked inflaming the White House if McCabe were to not be fired. But a decision to dismiss McCabe two days before his retirement carried the risk of angering his rank-and-file supporters at the FBI.

McCabe, a lawyer by training, enjoyed a rapid career ascent in the bureau after joining in 1996. He was the FBI’s top counterterrorism official during the Boston Marathon bombing and later the FBI’s national security branch and its Washington field office, one of the bureau’s largest, before being named to the deputy director position.

But he became entangled in presidential politics in 2016 when it was revealed that his wife during an unsuccessful bid for the Virginia state Senate had received campaign contributions from the political action committee of then-Virginia Gov. Terry McAuliffe, a close Clinton ally. The FBI has said McCabe received the necessary ethics approval about his wife’s candidacy and was not supervising the Clinton investigation at the time the contributions were made.

He became acting director following the firing last May of Comey, and immediately assumed direct oversight of the FBI’s investigation into possible coordination between Russia and the Trump campaign. At a congressional hearing two days after Comey’s dismissal, McCabe contradicted White House assertions that the Trump campaign investigation was one of the “smallest things” on the FBI’s plate and also strongly disputed the administration’s suggestion that Comey had lost the respect of the bureau’s workforce.

“I can tell you that the majority, the vast majority of FBI employees, enjoyed a deep and positive connection to Director Comey,” McCabe said.

McCabe was among the officials interviewed to replace Comey as director. That position ultimately went to Christopher Wray.

On Thursday, White House spokeswoman Sarah Huckabee Sanders told reporters the decision was up to the Justice Department but said “we do think that it is well documented that he has had some very troubling behavior and by most accounts a bad actor and should have some cause for concern.”