Former FBI director James Comey has accused US President Donald Trump of firing him to try to undermine the bureau's investigation into possible collusion between his 2016 presidential campaign team and Russia.

In the most eagerly anticipated US congressional hearing in years, Mr Comey told lawmakers the Trump administration had lied and defamed him and the FBI after the president dismissed him on 9 May.

The administration gave differing reasons for the action at the time and Mr Trump later contradicted his own staff and acknowledged on 11 May that he fired Mr Comey because of the Russia probe.

Asked at a US congressional hearing today why he was fired, Mr Comey said he did not know for sure. But he added: "Again, I take the president's words. I know I was fired because of something about the way I was conducting the Russia investigation was in some way putting pressure on him, in some way irritating him, and he decided to fire me because of that."

During more than two hours of testimony, Mr Comey told the Senate Intelligence Committee he believed Trump had directed him to drop an FBI probe into the Republican president's former national security adviser Michael Flynn as part of the broader Russia investigation.

But Mr Comey would not say whether he thought the president sought to obstruct justice.

"I don't think it's for me to say whether the conversation I had with the president was an effort to obstruct. I took it as a very disturbing thing, very concerning," Mr Comey told the Senate Intelligence Committee.

The former FBI head said Mr Trump's administration had defamed him in comments made after his firing by saying that the bureau was in disarray and that the workforce had lost confidence in its leader.

"Those were lies, plain and simple," Mr Comey said.

Tonight, a private lawyer for Mr Trump denied Mr Comey's allegations and suggested the the sacked FBI director should be prosecuted for leaking "privileged information".

The president, said Marc Kasowitz, "never told Mr Comey 'I need loyalty, I expect loyalty' in form or substance," rejecting a key allegation made by Mr Comey.

Mr Kasowitz rejected key parts of Mr Comey's damning testimony while claiming other parts as a win for the president.

Mr Comey's accusations could further mire Mr Trump's administration in legal difficulties, as special counsel Robert Mueller and several congressional committees investigate alleged Russian efforts to influence the 2016 presidential election and whether Mr Trump's campaign colluded with Moscow.

Russia has denied such interference and the White House has denied any collusion.

Key points from the hearing:

- Mr Comey said Mr Trump had repeatedly told him he was doing a great job.

- Mr Comey said the administration chose to defame him and the FBI by saying the organisation was in disarray. Mr Comey said "those were lies, plain and simple".

- Mr Comey said he has no doubt Russia attempted to interfere with the US election. Mr Comey said he is confident no votes cast in 2016 election were altered.

- Mr Comey said it is not for him to say whether Mr Trump tried to obstruct justice in their conversations.

- Mr Comey said he found conversations with Trump very disturbing.

- Mr Comey said Trump did not ask him to stop Russia investigation.

- Mr Comey said FBI became aware of Russian cyber intrusion in late summer of 2015.

In written testimony released by the Senate Intelligence Committee yesterday, Mr Comey quoted Mr Trump as telling him the Russia investigation was a "cloud" impairing his ability to operate as president.

Mr Trump fired the FBI chief on 9 May, and has since called Mr Comey a "showboat" and a "grandstander."

Democrats, along with some Republicans, on the committee will use today’s hearing to press for further details of any attempts by Mr Trump to blunt the Russia investigation.

Mr Kasowitz, released a statement yesterday saying the president felt "totally vindicated" by Mr Comey's acknowledgement that he had told Mr Trump on three occasions that he was not personally under investigation.

Despite landing himself in other political controversies, including his handling of the FBI investigation of 2016 Democratic presidential nominee Hillary Clinton's private email server, Mr Comey is widely seen as cautious and fact-oriented.

"One thing you don't ever hear about him is (that) people don't think he tells the truth. He brings a lot of credibility," said Benjamin Wittes, a Comey confidant and senior fellow at the Brookings Institution.

Mr Trump is widely expected to use his Twitter account, which lists 31.8 million followers, to counter punch at Mr Comey.