SAUSALITO, Calif. — The former F.B.I. director James B. Comey said on Thursday that he knew of no electronic surveillance aimed at the Trump campaign during the 2016 presidential election, defending the bureau after Attorney General William P. Barr asserted a day earlier that the bureau spied on the campaign as part of the Russia investigation.
“When I hear that kind of language used, it’s concerning because the F.B.I., the Department of Justice conduct court-ordered electronic surveillance,” said Mr. Comey, who oversaw the inquiry until President Trump abruptly fired him in May 2017. “I have never thought of that as spying.”
Mr. Barr said in congressional testimony on Wednesday that the bureau might have taken improper measures while investigating links between Mr. Trump’s campaign and Russia, describing the F.B.I.’s conduct as “spying,” a term typically associated with unlawful surveillance.
“I think spying did occur,” Mr. Barr said. “The question is whether it was adequately predicated. And I’m not suggesting that it wasn’t adequately predicated. But I need to explore that.”
Mr. Barr’s statement lined up with that longstanding talking point used by Mr. Trump and his allies. A person who has discussed the matter with Mr. Barr said that he did not mean to imply that the measures had been improper, but Mr. Barr never released a statement clarifying his remarks.
Mr. Trump said again on Thursday that he believed “there was absolutely spying into my campaign.”
“I’ll go a step further: In my opinion, it was illegal spying, unprecedented spying, and something that should never be allowed to happen in our country again,” Mr. Trump said. “And I think his answer was actually a very accurate one.”
Democrats on Capitol Hill accused Mr. Barr of imparting the authority of his office onto right-wing conspiracy theories favored by the president and his allies that American authorities illegally monitored the Trump campaign. Senator Chuck Schumer of New York, the Democratic leader, echoing members of his party, said the attorney general had lost all credibility.
“Barr’s comments yesterday have just destroyed the scintilla of credibility he had left in terms of being a fair and impartial person,” Mr. Schumer told reporters, while accusing Mr. Barr of behaving like “the press secretary to the president.”
In 2016, the F.B.I. sent an informant, a typical investigative step, to speak to two Trump campaign advisers after agents uncovered evidence that both had suspicious contacts linked to Russia during the campaign. When the role of the informant gained attention last year, the president seized on it to accuse law enforcement officials of illegally infiltrating his campaign.
Mr. Comey is familiar with the issue. In March 2017, Mr. Trump accused the F.B.I. and Obama administration in a tweet of illegally wiretapping Trump Tower during the campaign. The tweet angered Mr. Comey, who knew the claim was false and pushed the Justice Department to refute it. The Justice Department never release a statement, but Mr. Comey later said publicly that Mr. Trump’s claim had no merit.
“If the attorney general has come to the belief that that should be called spying, wow,” Mr. Comey said at a cybersecurity conference outside San Francisco. “That’s going to require a whole lot of conversations inside the Department of Justice. But I don’t know what he meant.”
Mr. Comey said that regardless of what the special counsel, Robert S. Mueller III, found during his investigation into Mr. Trump and his campaign, Mr. Barr already revealed, in his letter to Congress last month, that the investigation had uncovered important facts about Russia’s interference in the 2016 election.
“It tells us even without even reading the Mueller report that the Russia thing was not a hoax,” Mr. Comey said. “That it was real and that it is backed — that assessment is backed by hard evidence. It is true that the Russians came after us. They are going to come again because they exceeded their wildest hopes.”
Despite Mr. Barr’s claims about spying, Mr. Comey said he would give Mr. Barr the benefit of the doubt that he would put following the facts and law above protecting the president.
“Maybe the only thing I can say generally is I think his career has earned him a presumption that he will be one of the grayer Trump cabinet members who will stand up for things like truth and facts and institutional values. So I still think he’s entitled to that presumption,” Mr. Comey said. “Language like this makes it harder, but I still think he’s entitled to that presumption because I don’t understand what the heck he’s talking about — that’s all I can say.”