WASHINGTON — FBI Deputy Director Andrew McCabe, a frequent target of President Donald Trump's criticism who led the bureau for months last year following the firing of James Comey, is leaving his position ahead of a previously planned retirement this spring, people familiar with the decision said Monday.

McCabe had been widely expected to retire upon his eligibility date, but his departure from the FBI's No. 2 slot is effective Monday, according to the people, who spoke on condition of anonymity to discuss an internal personnel move.

McCabe alerted FBI staff of his decision Monday. He is expected to retire with his pension benefits.

McCabe has been repeatedly attacked by Trump since the fall of 2016, when it was revealed that his wife had accepted campaign contributions from the political action committee of Virginia Gov. Terry McAuliffe, a Democrat and close Clinton ally, during a failed state Senate run.

The FBI has said McCabe received the necessary ethics approval before his wife received the donations, and that at the time of the contributions, he was not in a supervisory role of the FBI's investigation into Hillary Clinton's email use.

But that has not stopped Trump from repeatedly insinuating that McCabe, and other FBI officials, are partisan law enforcement officials harboring a bias against him.

Upon December news reports that McCabe would retire, the president wrote: "How can FBI Deputy Director Andrew McCabe, the man in charge, along with leakin' James Comey, of the Phony Hillary Clinton investigation (including her 33,000 illegally deleted emails) be given $700,000 for wife's campaign by Clinton Puppets during investigation?"

McCabe became deputy director in 2016 following earlier jobs running the FBI's Washington field office and serving as head of its national security branch.

He took over as acting director following Trump's May 9 firing of Comey, and was among the officials interviewed for the position, which ultimately went to former Justice Department official Christopher Wray.

Two days after Comey's firing, McCabe pushed back at a congressional hearing against White House assertions that Comey had lost the support of the FBI workforce, telling lawmakers at a hearing, "I can tell you that the majority, the vast majority of FBI employees, enjoyed a deep and positive connection to Director Comey."