(Video: Reuters)

Former FBI director James B. Comey on Thursday used a dramatic appearance before a national audience to sharply criticize the character of the president, accusing Trump of firing him over the Russia investigation and then misleading the public about the reasons for the dismissal.

Trump and his team, Comey said, told “lies, plain and simple,” about him and the FBI in an effort to cover up the real reason for his sudden sacking last month. Comey said that after one particularly odd private meeting with the president, he feared Trump “might lie” about the conversation, prompting him to begin taking careful notes after each encounter.

Comey revealed that after he was fired, he leaked notes on his interactions with Trump to the media, hoping that sharing the information would prompt the appointment of a special counsel to investigate the administration over possible links to Russia.

“It’s my judgment that I was fired because of the Russia investigation,” Comey said. “I was fired, in some way, to change — or the endeavor was to change the way the Russia investigation was being conducted.”

Comey’s testimony threatened to deepen the legal and political crisis engulfing the White House, which has struggled to respond to growing questions about the president’s conduct.

“I can definitely say the president is not a liar,” said White House deputy press secretary Sarah Huckabee Sanders after the hearing. “I think it’s frankly insulting that that question would be asked.”

Over nearly three hours of testimony in a packed hearing room, Comey grimly recounted the events that he said showed the president sought to redirect the Russia probe away from his former national security adviser, Michael Flynn, and get the FBI to publicly distance the president himself from the probe.

As Comey spoke, most senators on the dais sat spellbound. Republican members of the Senate Intelligence Committee sought to soften Comey’s version of events, noting that Trump never ordered him to drop the Flynn investigation but merely “hoped” he would. Democrats tried to build a case that Trump had obstructed justice by firing Comey.

Pressured by the administration to focus on the president’s legislative ambitions rather than the politically consuming investigation, Republican leaders defended the president after the hearing, with House Speaker Paul D. Ryan (Wis.) casting Trump as a political novice who isn’t “steeped in the long-running ­protocols” of Washington and is “just new to this.”

Comey declined to say whether he thought the president had obstructed justice, saying that was a determination to be made by Special Counsel Robert S. Mueller III.

In response to Comey’s testimony, Trump’s personal lawyer, Marc Kasowitz, released a statement saying the president “never, in form or substance, directed or suggested that Mr. Comey stop investigating anyone.”

Kasowitz also accused Comey of trying to “undermine this administration with selective and illegal leaks of classified information and privileged communications.”

Comey and Trump's interactions: what we know so far

The hearing, broadcast nationally by at least 12 television networks, was held in a cavernous space in the Hart Senate Office Building with hundreds of seats to accommodate the intense interest. Several lawmakers who do not serve on the committee took seats in the audience, a rarity on Capitol Hill. Most were Democrats eager to hear Comey’s claims of presidential impropriety.

Inside the hearing room, people audibly groaned or gasped when Comey said he had “no doubt” that Russian government officials were behind the hacking of the Democratic National Committee last year.

Anticipation for the hearing stretched far beyond the Hill. Sen. Joe Manchin III (D-W.Va.) walked into the hearing with a binder that included 20 of more than 600 questions he said were submitted to him by constituents.

Comey began his testimony by saying he became “confused and increasingly concerned” about the public explanations by White House officials for his firing on May 9, particularly after the president said in an interview that he was thinking about the Russia investigation when he decided to fire him.

The former director wasted little time repudiating White House statements that he was fired in part because of low morale among FBI employees who supposedly had soured on his leadership. Comey said the administration “chose to defame me and more importantly the FBI.”

“Those were lies, plain and simple,” Comey said. “And I’m so sorry that the FBI workforce had to hear them, and I’m so sorry the American people were told them.”

His most damning remarks were directed at the president, but in the course of his testimony, Comey also raised doubts about the judgment of a host of other people, including Justice Department officials such as former attorney general Loretta E. Lynch and current Attorney General Jeff Sessions.

During questioning, Comey said that while the Hillary Clinton email case was ongoing, Lynch asked him to refer to the probe as a “matter” rather than an “investigation.”

The former FBI director said he thought that that wording “gave the impression that the attorney general was looking to align the way we talked about our work with the way the campaign” talked about it. “That was inaccurate,” he said. “That gave me a queasy feeling.”

Regarding Sessions, Comey said he took his concerns about one particular conversation with Trump to the new attorney general and said he did not want to be left alone again in a room with the president. Comey said Sessions’s body language gave Comey the impression there was nothing to be done.

Comey described his state of mind as he tried to navigate a number of tense conversations with the president about the investigation into possible coordination between Trump associates and Russian operatives.

In his written testimony, released Wednesday, Comey described being summoned to a private dinner at the White House in January with the president, who told him: “I need loyalty. I expect loyalty.”

Comey said the conversation, in which Trump asked whether Comey intended to stay on as FBI director, despite three prior discussions in which Comey had said he did, raised concerns in his mind.

“My common sense told me what’s going on here is he’s looking to get something in exchange for granting my request to stay in the job,” Comey testified.

Comey made clear he felt the discussions were improper since Trump repeatedly pressed him about specific investigations that involved people close to the president.

The former FBI director described another interaction in February, one day after Flynn was forced to resign as national security adviser for misleading Vice President Pence about his contacts with Russian Ambassador Sergey Kislyak.

A number of senior officials had met with the president in the Oval Office to discuss terrorism. At the end of the meeting, according to Comey, Trump asked everyone to leave but Comey.

Sessions, the attorney general, lingered until the president told him to leave, too, Comey said.

“My sense was the attorney general knew he shouldn’t be leaving, which is why he was lingering,’’ Comey said. “I knew something was about to happen which I should pay very close attention to.”

Once they were alone, Comey said, the president told Comey he hoped he could let go of the investigation into Flynn.

“When it comes from the president, I took it as a direction,” Comey said.

At the time Flynn was fired, he was being investigated for possibly lying about his conversations with the Russian ambassador, Comey said.

He said he was shocked and concerned about the president’s request, but decided not to tell Sessions about it because he expected that the attorney general would soon recuse himself from the Russia probe, which he eventually did.

It was after this meeting that Comey went to Sessions about never being left alone with Trump again.

Comey’s account made clear that his relationship with Trump was fraught from their very first meeting, which occurred before the inauguration, when he told the president-elect that a dossier of unsubstantiated allegations against him had been circulating around Washington.

“I didn’t want him thinking that I was briefing him on this to sort of hang it over him in some way,” Comey said. “He needed to know this was being said, but I was very keen to not leave him with the impression that the bureau was trying to do something to him.”

Comey acknowledged, as the president has claimed, that he repeatedly told Trump that he was not personally under investigation. But he also said that in private meetings and one-on-one phone calls, the president repeatedly asked him to say publicly that he was not personally under investigation — something Comey did not want to do.

After firing Comey, the president tweeted a suggestion that there could be tapes of their private talks.

“The president tweeted on Friday after I got fired that I’d better hope there are not tapes,” Comey said. That made the ex-FBI director think any such tapes would back up his account of Trump’s improper statements, so he said he asked a friend of his to share with a reporter a memo he had written about the February conversation.

“I thought it might prompt the appointment of a special counsel,” Comey said.

Asked by Sen. Roy Blunt (R-Mo.) why he felt he had the authority to do that, Comey replied: “As a private citizen, I felt free to share that. I thought it was very important to get it out.”

The friend is Daniel Richman, a law professor and a former federal prosecutor who confirmed his role but declined to comment further. The reporter is Michael Schmidt of the New York Times, who declined to comment.

A special counsel was appointed — Mueller, who is a former colleague of Comey’s — and Comey has provided him with his memos, he testified Thursday.

Comey said he still has no idea whether the president has tapes of their conversations, but he said: “I hope there are, and I will consent to the release of them. . . . The president surely knows whether he taped me, and if he did, my feelings aren’t hurt.”

When the hearing was over, Sens. Richard Burr (R-N.C.) and Mark R. Warner (D-Va.), the two senior members of the committee, walked out to greet reporters camped in the hallway outside.

“This is nowhere near the end of the investigation,” Burr said.