Former FBI Director James Comey has accused US President Donald Trump of undermining the rule of law in the United States by lying about the FBI.

He also urged Republican lawmakers to "stand up and speak the truth" about Mr Trump's behaviour.

Mr Comey, who was fired by Mr Trump in May 2017 while he was leading an investigation into Russian interference in the 2016 US election and possible Trump campaign collusion, made his remarks after his second appearance this month before two House of Representatives committees.

Mr Comey said lawmakers had again asked about former Secretary of State Hillary Clinton's emails and a dossier that Republicans claim was used to justify a warrant to conduct secret surveillance of a Trump presidential campaign aide.

"This while the president of the United States is lying about the FBI, attacking the FBI and attacking the rule of law in this country. How does that make any sense at all?"

Mr Comey told reporters after spending more than five hours being interviewed behind closed doors by the House Judiciary and House Oversight committees.

"Republicans used to understand that the actions of a president matter, the words of a president matter, the rule of law matters and the truth matters. Where are those Republicans today?" Mr Comey asked.

Mr Trump has called the Russia investigation by Special Counsel Robert Mueller a "witch hunt" and yesterday on Twitter labeled his own former personal lawyer Michael Cohen a "rat" for cooperating with prosecutors.

Mr Trump also accused Federal Bureau of Investigation agents of breaking into Mr Cohen's office when they were in fact acting with a search warrant.

Mr Cohen was sentenced to three years' prison last Wednesday for crimes including orchestrating hush payments to women in violation of campaign laws before the 2016 election.

Mr Cohen said he was directed by Mr Trump.

"The FBI's reputation has taken a big hit because the president of the United States, with his acolytes, has lied about it constantly," Mr Comey said when asked whether he bore any responsibility for damaging the FBI's reputation.

Mr Comey said "at some point someone has to ... stand up for the values of this country and not slink away in retirement, but stand up and speak the truth."

Asked about the president calling Mr Cohen a "rat," Mr Comey said it undermined the rule of law.