Former FBI Director James Comey lied to President Trump three times about him personally not being under investigation — which would explain why he refused to say that in public, according to a new bombshell report.

According to the report by RealClearInvestigations, not only was Trump personally targeted, but Comey himself was acting as an investigative agent as he interacted with the president — completely unbeknownst to the latter.

That would also explain why Comey made memos of his meetings with Trump. The new report reveals that Comey would also put those notes into an investigative file and even call other top FBI officials afterwards.

Comey has previously said he considered the memos personal instead of government documents, according to the Wall Street Journal. He also reportedly said they were written contemporaneously to create a record of his interactions with Trump, and he testified to Congress that he decided to do so because of the “nature of the person.”

Trump, not realizing Comey was lying to him, was angered by his refusal to say publicly that he was not personally under investigation and fired him in a letter that acknowledged that Comey had told him privately he was not under investigation three times.

Comey denied in his own memoir of having a “counterintelligence case file open” on Trump in the “literal sense.”

However, the report revealed, according to sources briefed on Justice Department Inspector General Michael Horowitz’s investigation, that Comey was secretly trying to build a conspiracy case against Trump while acting as an investigative agent.

Two U.S. officials told RealClearInvestigations that Comey was essentially “running a covert operation” against Trump, which began when he gave a private “defensive briefing” to Trump on January 6, 2017, about Russian election interference efforts that included telling him about the “pee dossier.”

In addition, Comey had an agent inside the White House who reported back to the FBI about Trump and his aides, according to the report.

The report also said Comey was “not working in isolation.”

The day before his private briefing to Trump, Comey met in the Oval Office with President Obama, Vice President Joe Biden, National Security Adviser Susan Rice, Homeland Security Secretary Jeh Johnson, Deputy Attorney General Sally Yates, and National Intelligence Director James Clapper to discuss how to brief Trump.

Comey was reportedly chosen to confront Trump with “the material” that accused him of being compromised by Russia and engaging in a criminal conspiracy with Moscow to hack the election.

The morning before his briefing with Trump, Comey reportedly met at FBI headquarters with a group of counterespionage officials and agents who were read in on the plan — code-named the “sensitive matter team.”

Comey only told Trump the most lurid rumor in the dossier — that he had allegedly requested a “golden showers” show by prostitutes in Moscow, but did not tell Trump the dossier was paid for by the Clinton campaign and the Democratic National Committee, or written by an ex-British spy and based on Russian sources.

Comey also did not mention that he had signed a surveillance warrant to eavesdrop on one of Trump’s former campaign advisers, or that his then-National Security Adviser Michael Flynn was under investigation.

Five minutes after Comey left that meeting with Trump, he typed up his notes on his laptop in his government vehicle.

“I executed the session exactly as planned,” Comey reported back to his “sensitive matter team.”

Comey would later claim in his book that he was “protecting” the president-elect by giving him that briefing, but several former and current federal law enforcement officials told RealClearInvestigations that Comey was really testing his reaction to see if he showed signs of guilt or revealed information that could be used against him.

Former federal prosecutor Andrew McCarthy told RealClearInvestigations:

They were hoping to surveil him incidentally, and they were trying to make a case on him,. The real reason Comey did not want to repeat publicly the assurances he made to Trump privately is that these assurances were misleading. The FBI strung Trump along, telling him he was not a suspect while structuring the investigation in accordance with the reality that Trump was the main subject.

Former FBI counterintelligence agent and lawyer Mark Wauck told RealClearInvestigations that the FBI lacked legal grounds to treat Trump as a suspect. “They had no probable cause against Trump himself for ‘collusion’ or espionage … . They were scrambling to come up with anything to hang a hat on, but had found nothing.”

House Intelligence Committee Vice Chairman Devin Nunes (R-CA) told RealClearInvestigations that he believes Comey was attempting to stop the Trump presidency for political reasons.

“You have the culmination of the ultimate spying, where you have the FBI director spying on the president, taking notes [and] illegally leaking those notes of classified information,” Nunes said.

According to the report, Comey had nine conversations with Trump between January and May 2017, and almost every time, would go back to the FBI headquarters and write up a memo documenting his version of the conversation as well as writing an update of the Crossfire Hurricane investigation — the FBI’s code name for the probe it launched into Trump’s campaign in July 2016.

Comey would lock the notes in a safe. The notes cited classified sources and methods, and the identities of witnesses and informants along with code names their FBI handlers gave them. They also documented the assistance provided by foreign intelligence agencies that are said to be a map of his agents’ investigative activity and his own interactions with the president.

After the private dinner he had with Trump at the White House in January 2017,Comey went home and wrote a memo about their conversation, printed it out, and attached it as a memo to the case file, “much like a field agent writing up an FD-302 evidentiary report after interviewing a suspect,” according to the report.

He locked a copy of it in his personal safe and filed another copy at the FBI after sharing it with FBI senior leadership. He also personally searched Trump on Google and looked through “hours of YouTube videos” of Trump.

After a February 2017 meeting with Trump wherein he asked Comey if he could “see his way clear” to ending the probe of Flynn, Comey immediately phoned FBI Deputy Director Andrew McCabe to tell him about it.

He later “huddled” with his deputies at the FBI to review his memo and discuss opening an investigation into whether Trump had tried to obstruct the Flynn case, according to the report. General Counsel James Baker, Chief of Staff Jim Rybicki, and Associate Deputy Director David Bowdich were also in the room, along with the heads of the FBI’s national security and counterintelligence units, according to the report.

Horowitz’s report into whether there was misconduct at the FBI in handling the investigation on the Trump campaign is due to be released in early September. According to the report, his team has examined more than one million records and conducted more than 100 interviews, including sit-downs with Comey and other current and former FBI and Justice Department personnel.

An attorney for Comey declined to respond to RealClearInvestigations.

Comey filed at least two reports after Trump asked him to clear his name and encouraged him to go after any associates if they actually had done something wrong. Comey reported those requests to then-acting Deputy Attorney General Dana Boente, who is now the general counsel of the FBI.

After Trump fired him when Comey refused to tell the Senate that Trump was not under investigation as he had privately told the president, McCabe ordered agents to formally begin investigating Trump for espionage and obstruction of justice.

“It’s pretty clear that Comey’s firing is what prompted McCabe’s fury,” former federal prosecutor and independent counsel Solomon L. Wisenberg told RealClearInvestigations.

McCabe’s former aide Lisa Page admitted in her closed-door congressional interview that when McCabe ordered the investigations, they still had not connected Trump to the Russia conspiracy.

While Comey was investigating Trump, he also put an FBI agent inside the White House as a cybersecurity adviser — Anthony Ferrante — so that he could report back to the FBI, according to the report.

“In an unprecedented action, Comey created a new FBI reserve position for Ferrante, enabling him to have an ongoing relationship with the agency, retaining his clearances and enabling him to come back in [to bureau headquarters],” a former National Security Council official told RealClearInvestigations.

The position was in direct-conflict with the no-contact policy between the White House and the DOJ, the former official said. Ferrante left in April 2017 and went to work for BuzzFeed. He now works at FTI Consulting, according to the report.

Another FBI official, Jordan Rae Kelly, who worked closely with Mueller when he headed the FBI, replaced Ferrante upon his White House exit in April 2017, though she signed logs allowing Ferrante to continue visiting the White House. After she left the White House, she also joined FTI Consulting.

According to the report, working with Ferrante at the NSC in early 2017 was another official, Tashina Gauhar, who remains a top national security adviser at the Justice Department.

Gauhar assisted former acting Attorney General Sally Yates in the Flynn investigation, then-Deputy Attorney General Rod Rosenstein in initially resisting Trump’s order to fire Comey, and took “copious notes” during meetings with White House lawyers that were later cited in the special counsel report in the section dealing with obstruction of justice.