WASHINGTON — Fired FBI Director James Comey testified Thursday that he was "confused" and "concerned" when President Donald Trump told the public he was firing him for undermining the morale of the agency he had led since 2013.

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

The Trump administration, he said, "chose to defame me and, more importantly, the FBI by saying that the organization was in disarray, that it was poorly led, that the workforce had lost confidence in its leader."

Live Blog: Latest Developments, Reaction to Comey's Testimony

Comey also said that while he didn’t want to express an opinion on whether Trump was seeking to obstruct the ongoing investigation into Russians meddling into the presidential election, he is “sure” the special counsel, Robert Mueller, will be examining that. And he said he is sure he was fired because of "the Russia investigation."

Comey also explained why he wrote memos chronicling his private conversations with Trump: he had a "gut feeling" the president might lie about the nature of the meetings.

"I knew there might come a day when I needed a record of what happened," he said, citing the "nature" of the person he was dealing with. He added that he never felt the need for such a record in dealing with two former presidents, Barack Obama and George W. Bush.

Questioned about Trump's public statement that Comey had "better hope that there are no tapes of our conversations," the former director replied, "Lordy, I hope there are tapes."

Comey's forthright and unflinching remarks to the committee — openly acknowledging his fear of the president's mendacity — made for two hours and 40 minutes of dramatic sworn testimony before the Senate Intelligence Committee.

Except for a few instances where the questioning veered off into Comey's disputed handing of the Hillary Clinton email investigation, the focus was on Trump. And there have been only a few similar moments in history where a sitting president was exposed to such scathing congressional testimony from a respected public servant.

While Comey stated emphatically he had no doubt at all that the Russians tried to influence the election, Trump was watching the unfolding drama in the White House dining room with his legal teams and close advisers. Though associates had said he might use Twitter during the hearing, his account remained silent.

After the hearing, Trump’s private lawyer, Marc Kasowitz, insisted Comey's testimony buttressed the president's contention that "he was not under investigation as part of any probe into Russian interference." He proclaimed Trump had been vindicated, and also focused on Comey's admission that he gave copies of his Trump conversation memo to a Columbia University law professor to distribute to the media in the hopes of prompting the appointment of a special counsel.

Kasowitz called Comey's actions "retaliatory."

"It is overwhelmingly clear that there have been and continue to be those in government who are actively attempting to undermine this administration with selective and illegal leaks of classified information and privileged communications," he said. "Comey has now admitted that he is one of these leakers." He suggested that federal authorities determine whether Comey's leaks should be investigated.

NBC News has confirmed that the law professor was Daniel Richman, who has known Comey for decades. Comey was no longer employed by the government when he turned over the memo, and it is not clear whether Kasowitz was correct when he accused Comey of leaking privileged information.

Earlier, White House spokeswoman Sarah Huckabee Sanders bristled at her boss' honesty being questioned by Comey.

"I can definitely say the president is not a liar," she told reporters. "Think it's frankly insulting the question would be asked."

Comey gave Washington and the worlda preview of the testimony to come on Wednesday when he released an opening statement in which he revealed that he told Trump on Jan. 6 he was not personally under investigation.

But Comey, fired by Trump last month, also said the president pressured him during a private meeting on March 30 to publicly reveal he was not personally being probed by the FBI. Trump’s reason? He wanted to “lift the cloud” on his presidency, according to Comey.

Trump and Comey met after the ousted FBI chief revealed federal agents were investigating whether the Trump campaign colluded with the Russian effort to meddle with the presidential election.

Under oath, Comey also confirmed an earlier news report that Trump pressured him on Feb. 14 into dropping the FBI investigation of former National Security Advisor Michael Flynn — a tactic Comey considered crossing the line.

Comey told the senators he was taken aback when Trump told Attorney General Jeff Sessions, top Trump adviser Jared Kushner and others to leave the room before he brought up Flynn.

"Why did he kick everyone out of the Oval Office?” Comey asked. "That to me as an investigator is a very significant fact."

Regarding Sessions, Comey hinted at something significant that has not yet been made public. He said he knew ahead of time that Sessions would have to recuse himself from the investigation, but would not discuss the reasons. "We were aware of facts that I can't discuss in an open setting that would make his continuing very problematic," Comey said.

Related: Who Is the 'Good Friend' Who Leaked Comey Memo?

He gave a similar tantalizing answer when asked outright whether Trump colluded with Russia during the election campaign.

"That's a question I don't think I should answer in an open setting," he said. "That is a question that will be answered by the investigation."

Comey said that when Trump told him he "hoped" the Flynn matter could be settled, a phrase out of old English history came to mind.

"It rings in my ears of 'who will rid me of this meddlesome priest?'," he said, referring to the words purportedly said by King Henry II about Thomas Becket in the 12th century. Becket was later killed by Henry's knights, and Becket became a saint.

Asked why he didn't tell Trump this was wrong, Comey responded, "Maybe if I was stronger I would have."

"I was so stunned by the conversation I just took it in," he said.

In his written statement, Comey wrote that neither he nor his subordinates at the FBI reported the conversation to the Justice Department.

“After discussing the matter, we decided to keep it very closely held, resolving to figure out what to do with it down the road as our investigation progressed,” he wrote. "I think they were as shocked and troubled by it as I was. The reaction was similar to mine. They were all experienced people who had never experienced such a thing so they were very concerned."

Comey also mentioned in the memo a private White House dinner he had with Trump during which he said the president asked for his loyalty.

“I need loyalty, I expect loyalty,” Trump said, according to Comey.

Comey said he could offer honesty. And in testimony before the senators, Comey swatted away a claim Trump made in an interview with NBC's Lester Holt that Comey had dinner with him "because he wanted to stay on" as FBI Director.

"No sir," Comey answered when asked if Trump's assertion was true. "He said, 'I was going to invite your whole family, but we'll do that next time.'"

The former FBI chief said his last contact with Trump was on April 11. “The president called me and asked what I had done about his request that I ‘get out’ that he is not personally under investigation,” he wrote.

"I replied that I had passed his request to the Acting Deputy Attorney General, but I had not heard back. He replied that 'the cloud' was getting in the way of his ability to do his job."

Rep. Adam Schiff (D-California) said Thursday on MSBNC he found Comey’s account “quite shocking.”

“I think it's hard to reach any other conclusion but that this is evidence of interference and obstruction,” he said.

Ken Dilanian reported from Washington, and Corky Siemaszko from New York.