FBI Deputy Director Andrew McCabe, criticized by President Donald Trump for alleged bias against him and in favor of his 2016 Democratic opponent Hillary Clinton, has stepped down as the agency's No. 2 official, a source familiar with the matter said on Monday.

McCabe had been expected to leave the Federal Bureau of Investigation in March. He will remain on leave until his retirement date, the source said, speaking on condition of anonymity because a public announcement has not yet been made.

McCabe has become a target of Republican lawmakers and the Republican president in connection with the FBI's investigation into Clinton's use of a private email server while she served as U.S. secretary of state. No charges were brought against Clinton.

A handful of Republican-led congressional committees have launched inquiries into whether the FBI botched the Clinton investigation and showed bias in her favor. Democrats have said those inquires are intended to undermine and distract from Special Counsel Robert Mueller's investigation into whether Trump's 2016 presidential campaign colluded with Russia.

Comey loyalist

The early departure comes after McCabe endured months of tough criticism from Republicans for his loyalty to fired FBI director James Comey and alleged bias against Trump.

McCabe and Comey had key roles in the FBI's probe of Trump's rival Hillary Clinton in the 2016 election, which ultimately cleared the Democrat of criminal wrongdoing in her misuse of a personal email server while she was secretary of state. The president has repeatedly assailed that decision as wrong.

Both were also involved in the initial stages of an ongoing investigation into whether the Trump campaign colluded with Russians during the election, which Trump calls "fake news."

After Trump fired Comey on May 9, 2017, McCabe became acting director of the FBI.

Days later he appeared before Congress, rebutting Trump's claim that Comey had left the bureau "in turmoil" and lost the confidence of the FBI staff.

Comey "enjoyed broad support within the FBI and still does," McCabe said.

Sharp attack from Trump

Accusations of bias also arose from McCabe's wife having run as a Democrat for local Virginia political office as a Democrat in 2015, receiving financial support from the party.

In July 2017 Trump questioned why Attorney General Jeff Sessions did not dismiss him.

"Why didn't A.G. Sessions replace Acting FBI Director Andrew McCabe, a Comey friend who was in charge of Clinton investigation but got big dollars ($700,000) for his wife's political run from Hillary Clinton and her representatives," he wrote on Twitter.

After naming a new FBI director in August, Christopher Wray, Trump kept up the pressure.

He tweeted again in December about McCabe's wife, and his role in the Clinton probe. He added a hint that McCabe was soon to depart, before it was publicly known.

"FBI Deputy Director Andrew McCabe is racing the clock to retire with full benefits. 90 days to go?!!!" Trump wrote.

But McCabe retained strong support from within the Justice community, and Democrats have called Trump's pressure a part of a broader campaign to tarnish the bureau and weaken the Mueller collusion investigation.

Former attorney general Eric Holder lauded McCabe in a statement Monday.

"FBI Deputy Director Andrew McCabe is, and has been, a dedicated public servant who has served this country well. Bogus attacks on the FBI and DOJ to distract attention from a legitimate criminal inquiry does long term, unnecessary damage to these foundations of our government."