Federal investigators became alarmed by President Donald Trump’s behavior in the immediate aftermath of his firing in 2017 of former FBI director James Comey, and opened a probe into whether the president had been secretly working with Russia, The New York Times reported late Friday.

The publication said that counterintelligence officials weighed whether Trump’s actions were undermining national security, and whether he was either working at the behest of Moscow.

Federal investigators became alarmed by President Donald Trump’s behavior in the immediate aftermath of his firing in 2017 of former FBI director James Comey, and opened a probe into whether the president had been secretly working with Russia, The New York Times reported late Friday.

Citing unnamed sources familiar with the investigation, the publication said that counterintelligence officials weighed whether Trump’s actions were undermining national security, and whether he was either working at the behest of Moscow, or was somehow influenced by the Kremlin. Trump has repeatedly denied that he colluded with Russia, while even Comey has stated publicly that Trump himself was not a focus of the FBI’s probe into his campaign’s ties to Moscow.

Yet allegations that Trump was somehow compromised by Russia were first broached by the controversial Steele dossier, a raw intelligence document interspersed with lurid and largely uncorroborated accusations against the president that was assembled by a former British spy.

The Times reported on Friday that agents and senior FBI officials had their suspicions aroused about Trump’s ties to Russia during the 2016 election, but refrained from opening an investigation into him because of how sensitive the undertaking would be. However, sources told the publication that on two occasions, Trump tied Comey’s dismissal to the Russia probe, which led to a counterintelligence track being added to the original Russia inquiry.

In theory, Comey’s axing would constitute obstruction, because of the impact it would have had on the FBI’s ability to learn about Moscow’s meddling, and whether U.S. citizens were involved.

According to The Times report, it’s unclear if Special Counsel Robert Mueller is still pursuing the counterintelligence probe as he pursues a wide ranging investigation into whether campaign officials, or Candidate Trump himself, knew of Russia’s efforts to influence the election. Still, the investigation into whether the president obstructed justice by firing Comey was lumped in with the counterintelligence inquiry, according to former law enforcement officials who spoke with the Times.

Rudolph W. Giuliani, Trump’s personal lawyer and the former mayor of New York City, dismissed the counterintelligence effort. “The fact that it goes back a year and a half and nothing came of it that showed a breach of national security means they found nothing,” Giuliani told The Times on Friday, but added that he had no insight into that particular track of the investigation.

A spokesperson for the FBI did not immediately respond to CNBC’s request for comment.