President Trump took fresh aim Thursday at former FBI director James B. Comey, writing on Twitter that the man he fired last year was “a terrible and corrupt leader who inflicted great pain” on his agency.

Trump’s broadside came a day after Comey spoke amid Trump’s continuing insistence that the FBI had spied on his campaign during the 2016 election — an episode Trump has dubbed “spygate.”

Trump has seized on reports that the FBI used a confidential source in its investigation into Russian interference in the 2016 election. There is no evidence to suggest that the source was inserted into the Trump campaign, as the president has suggested, but the source did seek out and meet Trump campaign advisers. The Washington Post has reported that the source was former University of Cambridge professor Stefan A. Halper, a longtime Republican.

In a tweet on Wednesday, Comey said that “attacks on the FBI and lying about its work will do lasting damage to our country.”

“How will Republicans explain this to their grandchildren?” he asked in his tweet.

Asked about Comey’s comments during a television interview taped later Wednesday, Trump returned fire at Comey.

“Well I’d actually say, how is he going to explain to his grandchildren all of the lies, the deceit, all of the problems he has caused for this country,” Trump said in the interview that aired Thursday morning on “Fox & Friends” on Fox News.

“I think of the things that I’ve done for the country, the firing of James Comey is going to go down as a very good thing,” Trump said. “The FBI is great. I know so many people in the FBI. The FBI is a fantastic institution, but some of the people at the top were rotten apples. James Comey was one of them.”

In another tweet Thursday, Trump continued to insist that James R. Clapper Jr., the former director of national intelligence, had acknowledged there was spying on Trump’s campaign.

That assessment was based on comments Clapper made earlier this week on ABC’s “The View,” according to Trump aides.

Asked if the FBI had spied on Trump’s campaign, Clapper said: “No, they were not. They were spying on — a term I don’t particularly like — but on what the Russians were doing. Trying to understand were the Russians infiltrating, trying to gain access, trying to gain leverage and influence which is what they do.”

In a separate interview on CNN, Clapper said Trump was distorting what he has said.

“The objective here was actually to protect the campaign by determining whether the Russians were infiltrating it and attempting to exert influence,” Clapper said.