A Republican former CIA officer attacked the agency’s outgoing director — who reportedly investigated possible Kremlin funding of the Trump campaign — over an infamous 35-page dossier.

CIA Director John Brennan has denied U.S. intelligence agencies were involved in leaking the memo compiled by a former British spy detailing Donald Trump’s alleged ties to Russia, including compromising videos of him with prostitutes at a Moscow hotel.

ADVERTISEMENT

Former intelligence officer Gary Berntsen, a former Tea Party candidate for U.S. Senate, rebuked Brennan for speaking out against the president-elect.

“Brennan needs to keep his mouth shut until he leaves the agency,” Berntsen told “Fox and Friends.” “When he’s a private citizen, he can say what he likes. But he’s damaging the agency and its officers with his behavior right now.”

Berntsen, who retired from the CIA in 2005, said Brennan’s criticism of Trump was unprecedented.

“In my 40 years of following politics, I have never seen a director of CIA attacking a president-elect,” Berntsen said.

Brennan has questioned whether the president-elect fully appreciates the threat posed by Russia against the world, but his concerns about Trump’s ties to the Kremlin may run deeper than that.

ADVERTISEMENT

According to a BBC report last week, the CIA director was allegedly shown a tape recording in April of a conversation about money from the Kremlin being funneled into the Trump presidential campaign.

Brennan was so concerned about the recording, which reportedly came from the intelligence service of a Baltic state, that he helped set up a joint counter-intelligence task force to investigate the evidence.

Lawyers from the National Security Division in the Department of Justice then applied for warrants in June and July from a judge under the Foreign Intelligence Surveillance Ac, the BBC reported.

ADVERTISEMENT

Those applications were rejected, but an order was finally granted by a new judge on Oct. 15 — three weeks before Election Day.

Trump was not named in the FISA order, which granted permission to intercept electronic records from two Russian banks, but a lawyer familiar with the case said investigators wanted to examine three of the president-elect’s associates and their ties to Russia.

ADVERTISEMENT

“It’s clear this is about Trump,” the lawyer told BBC.

Berntsen, speaking Tuesday morning to Fox News, said Brennan had damaged the CIA’s long-term credibility by engaging in political attacks.

“Brennan, the agency and the intelligence community did a very terrible job of looking at that insane dossier that was presented to Trump, which made grotesque accusations against the president-elect’s purported activities in Moscow, which never took place,” Berntsen said.

ADVERTISEMENT

The former CIA officer claimed intelligence officials could easily have checked the names listed in the memo — although few of the sources were identified by name — and checked them against travel databases to prove the former spy’s sources wrong.

“They’re either fools or acting maliciously,” Berntsen said.

Former CIA officer Gary Berntsen: John Brennan needs to keep his mouth shut until he leaves the CIA pic.twitter.com/JiwzT3jFOH — FOX & friends (@foxandfriends) January 17, 2017