Lightning-rod FBI Director James Comey will continue to lead the nation’s top law-enforcement agency, federal sources confirmed to The Post on Tuesday.

Comey informed his senior staff that President Trump has asked him to stay on despite the mountain of criticism he received for the way he managed the Hillary Clinton e-mail probe during the 2016 election, the sources said. Comey was accused by critics of trying to influence the election in Trump’s favor.

Just after Trump’s surprise victory in November, the billionaire businessman said during a TV interview that he wasn’t sure if he would keep Comey on.

But the newly minted president recently told Comey that he “loves him” and called him a “great guy,” a law-enforcement source said.

Trump told Comey that he didn’t “want him going anywhere,” the source said.

Comey dropped the news on his senior staff during a video conference last week, saying that he “was not leaving,” the source added.

He was sworn in as head of the FBI by under then-President Obama in 2013.

Comey is already navigating through rough terrain with the new president.

The FBI has opened formal investigations into Trump’s ex-campaign manager, Paul Manafort, and his ties to Russia, according to the New York Times.