Ex-FBI chief James Comey told Congress that the Trump administration's comments about him and the FBI were "lies plain and simple".
Mr Comey told a Senate committee they were wrong to denigrate the agency and its leadership.
He was also "confused" by the "shifting explanations" for his sacking, which came as he led a probe into any links between the Trump campaign and Moscow.
President Donald Trump later said he never sought to impede the inquiry.
Mr Trump's attorney, Marc Kasowitz, said in a statement Mr Comey's testimony "finally confirmed publicly" that the president was not under investigation as part of any probe in Russian political meddling.
In the statement, Mr Trump also denied asking Mr Comey for his loyalty or to drop an investigation into fired national security adviser Michael Flynn during private meetings.
In his testimony, Mr Comey said Mr Trump had repeatedly told him he was doing a "great" job.
He also suggested he was fired to "change the way the Russia investigation was being conducted".
The former FBI boss remained largely composed throughout almost three hours of testimony but became impassioned when delivering his opening remarks.
He told the panel that the White House "chose to defame me, and more importantly the FBI" by claiming the agency was "poorly led".
"Those were lies, plain and simple. And I'm so sorry that the FBI workforce had to hear them," he continued.
"The FBI is honest. The FBI is strong. And the FBI is and always will be independent," he said in his opening remarks.
Mr Comey was leading one of several Russia investigations before Mr Trump fired him.
US intelligence agencies believe Russia interfered in the US election and they are investigating alleged links between the Trump campaign and Moscow.
But there is no known evidence of collusion and President Donald Trump has dismissed the story as "fake news".
His spokeswoman Sarah Sanders on Thursday hit back at Mr Comey, saying: "I can definitively say the president is not a liar."
'Staggering blow' for Trump - Anthony Zurcher, BBC News
For Donald Trump the good news from James Comey's testimony is that the former FBI director clearly said the president was not directly under FBI investigation at the time he was fired. The bad news was, well, everything else.
On multiple occasions, Mr Comey said he was either concerned or knew that the president or his administration was lying "plain and simple" - about the circumstances of his dismissal and about the nature of his meetings with the president.
It's clear the president woefully mishandled this, for which he has paid a high price ever since. By unceremoniously sacking him, and offering a muddle of explanations for it, he created an adversary with both the means and the motivation to respond in the most damaging way.
Mr Comey had a friend leak disturbing information about the president's actions to the media. He was given the biggest spotlight in a generation to publicly air further details. He stood before a Senate committee not just to defend himself, but also the honour of the FBI.
The White House may claim today's testimony is a technical exoneration. Politically, however, it's a staggering blow. And when it comes to the presidency, politics is everything.
During Thursday's testimony, Mr Comey emphasised that Russia's political meddling was "not a close call", adding: "There should be no fuzz on this whatsoever."
When asked by the Senate Intelligence Committee whether the president tried to stop the Russia investigation, Mr Comey said: "Not to my understanding, no."
He said he it was not for him to say whether Mr Trump's actions were an obstruction of justice.
Democratic Senator Mark Warner, the committee's vice chairman, pressed Mr Comey on why he decided to keep a record of his conversations with Mr Trump.
"I was honestly concerned that he might lie about the nature of our meeting" he said.
Mr Comey, who published his prepared remarks a day before the hearing, detailed one meeting with Mr Trump in which the president asked Attorney General Jeff Sessions and White House aide Jared Kushner to leave the Oval Office.
"I knew something was about to happen that I needed to pay very close attention to," he said. "I remember thinking that that was a very disturbing development."
During another meeting with Mr Trump, Mr Comey said the president appealed to him to "let go" an investigation into fired national security adviser Michael Flynn and his ties to the Kremlin.
After US media reported the conversation, the president warned Mr Comey in a tweet, saying he "better hope there are no 'tapes' of our conversations".
Mr Comey told the committee he hoped there were tapes, calling on Mr Trump to release them.
"The president surely knows whether he taped me, and if he did my feelings aren't hurt. Release all the tapes, I'm good with it," he said.
The White House has refused to say whether any such tapes exist.
After Mr Trump's tweet about potential tapes, Mr Comey said he realised it was important to release his own account of the story.
He revealed that he asked a "good friend of mine" who is a professor at Columbia Law School to share contents of the memo with a reporter, in order to build pressure for a special counsel.
As a result of this episode, former FBI chief Robert Mueller was appointed as special counsel to lead an independent investigation into the Trump campaign's potential ties to the Kremlin.
Mr Comey said he was "sure" Mr Mueller was also looking at whether Mr Trump obstructed justice.
Mr Trump attacked Mr Comey for leaking the documents, saying it showed that members of the US government are "actively attempting to undermine this administration".
What's the reaction?
"He's new in government, and so therefore I think he's learning as he goes," said Republican House Speaker Paul Ryan. "I'm not saying it's an acceptable excuse. It's just my observation."
"If you want to convict the president of being inappropriate, putting Comey in a bad spot, being rude, crude and a bull in a china shop, you would win," Senator Lindsey Graham told the BBC.
"The American people elected a bull in a china shop to help them with their lives, not this."
Democratic Senator Chris Murphy said "it's hard to overstate the impact of Jim Comey's testimony today" and that "it seems like the walls are closing in".