Donald Trump has blasted the former director of the FBI as a “coward” shortly after he testified as to why he was fired during the Russia investigation.

Mr Trump tweeted: “I believe the James Comey leaks will be far more prevalent than anyone ever thought possible. Totally illegal? Very 'cowardly!’”

Mr Comey told a Senate hearing on Thursday that he had written a series of memos about his relationship with the President and had a friend leak them to the press.

Mr Trump asked Mr Comey to be loyal during a private dinner after the inauguration, and they ended up with a compromise of Mr Comey saying he would honour a pledge of “honest loyalty”.

“My common sense told me, he’s looking to get something in exchange for granting my request to stay in the job,’ said Mr Comey.

The news of their bizarre conversation at the dinner had been reported by the New York Times, creating much anticipation for the former director’s testimony this week.

Mr Comey also revealed that he was confused as to why he had been dismissed during an ongoing investigation into the President’s and his team’s alleged links with Russia before and after the election. Russians have denied interference while Mr Trump dismissed earlier intelligence reports that the meddling gave his campaign a boost.

Mr Comey said Russia did interfere with the election in a “sophisticated” manner, and it was an issue beyond party politics.

“This is a big deal,” he said.

Mr Comey did not confirm that he believed he was fired to prevent the investigation, but he said accusations that the FBI was in disarray were “lies, plain and simple”.

Mr Trump also told the former FBI director that he hoped Mr Comey “could let it go”, referring to the investigation of former national security adviser Michael Flynn.

Mr Flynn was forced to resign in February after he misled Vice President Mike Pence about his communications with the Russian ambassador.

Comey: I took Trump's request to drop Flynn probe as a direction