WASHINGTON — In the days after President Trump fired James B. Comey as F.B.I. director, law enforcement officials became so concerned by the president’s behavior that they began investigating whether he had been working on behalf of Russia against American interests, according to former law enforcement officials and others familiar with the investigation.
The inquiry carried explosive implications. Counterintelligence investigators had to consider whether the president’s own actions constituted a possible threat to national security. Agents also sought to determine whether Mr. Trump was knowingly working for Russia or had unwittingly fallen under Moscow’s influence.
The investigation the F.B.I. opened into Mr. Trump also had a criminal aspect, which has long been publicly known: whether his firing of Mr. Comey constituted obstruction of justice.
Agents and senior F.B.I. officials had grown suspicious of Mr. Trump’s ties to Russia during the 2016 campaign but held off on opening an investigation into him, the people said, in part because they were uncertain how to proceed with an inquiry of such sensitivity and magnitude. But the president’s activities before and after Mr. Comey’s firing in May 2017, particularly two instances in which Mr. Trump tied the Comey dismissal to the Russia investigation, helped prompt the counterintelligence aspect of the inquiry, the people said.
The special counsel, Robert S. Mueller III, took over the inquiry into Mr. Trump when he was appointed, days after F.B.I. officials opened it. That inquiry is part of Mr. Mueller’s broader examination of how Russian operatives interfered in the 2016 election and whether any Trump associates conspired with them. It is unclear whether Mr. Mueller is still pursuing the counterintelligence matter, and some former law enforcement officials outside the investigation have questioned whether agents overstepped in opening it.
The criminal and counterintelligence elements were coupled together into one investigation, former law enforcement officials said in interviews in recent weeks, because if Mr. Trump had ousted the head of the F.B.I. to impede or even end the Russia investigation, that was both a possible crime and a national security concern. The F.B.I.’s counterintelligence division handles national security matters.
If the president had fired Mr. Comey to stop the Russia investigation, the action would have been a national security issue because it naturally would have hurt the bureau’s effort to learn how Moscow interfered in the 2016 election and whether any Americans were involved, according to James A. Baker, who served as F.B.I. general counsel until late 2017. He privately testified in October before House investigators who were examining the F.B.I.’s handling of the full Russia inquiry.
“Not only would it be an issue of obstructing an investigation, but the obstruction itself would hurt our ability to figure out what the Russians had done, and that is what would be the threat to national security,” Mr. Baker said in his testimony, portions of which were read to The New York Times. Mr. Baker did not explicitly acknowledge the existence of the investigation of Mr. Trump to congressional investigators.
No evidence has emerged publicly that Mr. Trump was secretly in contact with or took direction from Russian government officials. An F.B.I. spokeswoman and a spokesman for the special counsel’s office both declined to comment.
Rudolph W. Giuliani, a lawyer for the president, sought to play down the significance of the investigation. “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,” Mr. Giuliani said on Friday, though he acknowledged that he had no insight into the inquiry.
The cloud of the Russia investigation has hung over Mr. Trump since even before he took office, though he has long vigorously denied any illicit connection to Moscow. The obstruction inquiry, revealed by The Washington Post a few weeks after Mr. Mueller was appointed, represented a direct threat that he was unable to simply brush off as an overzealous examination of a handful of advisers. But few details have been made public about the counterintelligence aspect of the investigation.
The decision to investigate Mr. Trump himself was an aggressive move by F.B.I. officials who were confronting the chaotic aftermath of the firing of Mr. Comey and enduring the president’s verbal assaults on the Russia investigation as a “witch hunt.”
A vigorous debate has taken shape among some former law enforcement officials outside the case over whether F.B.I. investigators overreacted in opening the counterintelligence inquiry during a tumultuous period at the Justice Department. Other former officials noted that those critics were not privy to all of the evidence and argued that sitting on it would have been an abdication of duty.
The F.B.I. conducts two types of inquiries, criminal and counterintelligence investigations. Unlike criminal investigations, which are typically aimed at solving a crime and can result in arrests and convictions, counterintelligence inquiries are generally fact-finding missions to understand what a foreign power is doing and to stop any anti-American activity, like thefts of United States government secrets or covert efforts to influence policy. In most cases, the investigations are carried out quietly, sometimes for years. Often, they result in no arrests.
Mr. Trump had caught the attention of F.B.I. counterintelligence agents when he called on Russia during a campaign news conference in July 2016 to hack into the emails of his opponent, Hillary Clinton. Mr. Trump had refused to criticize Russia on the campaign trail, praising President Vladimir V. Putin. And investigators had watched with alarm as the Republican Party softened its convention platform on the Ukraine crisis in a way that seemed to benefit Russia.