The FBI began investigating whether President Donald Trump was a witting or unwitting Russian agent after he fired FBI director James Comey in May 2017, The New York Times reported.

At the time, the bureau was already investigating whether the Trump campaign colluded with Moscow during the 2016 election, and Comey's firing prompted the special counsel Robert Mueller to open an obstruction-of-justice probe as part of the Russia investigation.

But The Times' report is the first indication that the FBI believed it was possible the president himself was a witting or unwitting Russian agent.

After President Donald Trump fired FBI director James Comey in May 2017, the bureau became so concerned about his actions that it opened a counterintelligence investigation into whether Trump was intentionally or unintentionally working for the Russians, according to a bombshell New York Times report.

At the time, the FBI was already conducting a separate investigation into Russia's interference in the 2016 US election and, crucially, whether the Trump campaign secretly coordinated with Moscow to tilt the race in Trump's favor.

Comey's firing prompted the special counsel Robert Mueller to open a new thread in the Russia investigation which examined whether Trump sought to obstruct justice when he ousted the FBI director. But The Times' report on Friday is the first indication that the FBI was concerned the president himself was a Russian asset and mounted a counterintelligence investigation with him as its target.

FBI agents had already been suspicious of Trump's ties to Russia since his 2016 presidential campaign but, according to The Times' sources, there was some concerns within the agency about how to approach the situation given its sensitivity. His decision to fire Comey, however, prompted them to move forward with the investigation.

Read more: Here are all the key developments you might have missed in Russia news this week

US President Donald Trump takes his seat as he attends the multilateral meeting of the North Atlantic Council in Brussels, Belgium. Pablo Martinez Monsivais/AP Photo

Trump's frustration with Comey has been well documented.

The president began laying into the former FBI director after Comey publicly confirmed the existence of the FBI's Russia investigation in March 2017, two months before he was fired. Afterward, Trump repeatedly tweeted criticism of Comey and downplayed the significance of continued revelations of contacts between his campaign and Russians during the election.

When Trump abruptly fired Comey, the White House initially said he had been dismissed because of his handling of the bureau's investigation into Hillary Clinton's use of a private email server when she was secretary of state. The White House also put out a statement from Trump which said he fired Comey upon the advice of then Attorney General Jeff Sessions and Deputy Attorney General Rod Rosenstein.

But Trump later told NBC's Lester Holt during an interview that he had fired Comey, in part, because of "this Russia thing" and that he would have fired Comey regardless of what Sessions or Rosenstein had advised.

It later surfaced that two days after firing Comey, Trump boasted to two top Russian officials during an Oval Office meeting that firing the "nut job" FBI director had taken "great pressure" off of him. He indicated that the pressure he faced stemmed from the Russia probe.

A month after he was fired, Comey publicly testified that Trump had privately pressured him on multiple occasions to drop the Russia investigation and to "let go" of the bureau's inquiry into Michael Flynn, the former national security adviser who was forced to resign after it emerged that he discussed US sanctions on Russia with the Russian ambassador during the transition period.

Trump has denied all of Comey's allegations, many of which have been supported by contemporaneous documentation from Comey and other senior Justice Department officials.

Trump's other public statements, including encouraging Russia to hack Clinton's emails during the campaign, also attracted scrutiny from the FBI, The Times reported.

It is unclear whether Mueller is still looking into the counterintelligence aspect of the investigation, according to The Times.

Trump attorney Rudy Giuliani, who the newspaper said had no knowledge of the FBI inquiry, appeared to be unfazed: "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," he told The Times.