Speaking publicly for the first time since his abrupt firing, former FBI director James Comey told a Senate panel Thursday that he took President Trump's words as "a direction" when Trump asked him to drop the FBI's investigation of former national security adviser Michael Flynn's ties to Russia.

"I didn’t obey that," Comey said to the Senate Intelligence Committee. "But that’s what I thought."

Comey said he now believes he was fired to relieve pressure from the ongoing investigation into possible collusion between Trump associates and Russia, which the U.S. intelligence community has accused of seeking to influence the 2016 presidential election by hacking Democrats.

“I was fired in some way to change the way the Russia investigation was being conducted,’’ Comey said. “That is a big deal. On top of that , the Russia investigation itself is vital because of the threat. And if any American were part of that, that is a very big deal.’’

The White House initially said Comey was fired because of his controversial handling of the investigation into Hillary Clinton's email server, on the recommendation of Justice Department leadership.

Yet in an interview soon after with NBC, Trump called Comey a "showboat" and a "grandstander" and confirmed that the Russia investigation was indeed on his mind when he fired Comey, adding he would have fired the FBI chief regardless of the Justice Department's recommendation. Comey said he was "confused" to learn on television that the president "actually" fired him because of the Russia investigation.

At the center of the testimony was a February 14 meeting at the White House. In that meeting, Comey said Trump strongly defended Flynn, arguing that his former national security adviser “hadn’t done anything wrong’’ in his prior contact with Russian ambassador Sergey Kislyak. Flynn had been fired the day before for lying to administration officials, including Vice President Pence, about his communications with Kislyak.

“I hope you can see your way clear to letting this go," Comey quoted the president as saying. "He is a good guy. I hope you can let this go."

Comey told the senators that he was "so stunned by the conversation that I just took it in." He also said that he hoped that the president was serious when he tweeted that there might be tapes of the conversation.

"Lordy, I hope there are tapes," Comey said, later promising to consent to the release of 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.”

However, Comey said he could not say whether Trump engaged in obstruction of justice when the president asked him to drop the FBI's investigation of Flynn. Comey said questions of obstruction would be investigated by Robert Mueller, the former FBI director who was appointed to be special counsel of the Russia investigation in the wake of Comey's firing.

Comey did say Flynn was in "legal jeopardy" at the time that Trump made his appeal.

The fired FBI chief said he was never asked by Trump or others to stop the bureau’s investigation into Russia’s interference in the 2016 elections, but he said Trump’s request that he drop the inquiry related to Flynn "disturbed" him.

Comey said he felt compelled to compose written records of his meetings with the president because he worried Trump might “lie’’ about what transpired.

The former director said he began to document his interactions from his first meeting the president on Jan. 6 after a tense briefing at Trump Tower.

“It was the subject matter and the person I was interacting with," he said. “It was the nature of the person. I was honestly concerned that he would lie about the nature of our meeting. I felt I got to write it down and I got to write it down in a detailed way. I knew there might come a day when I would need a written record to defend me and the FBI.’’

White House spokesperson Sarah Sanders declined comment on the testimony, deferring to a forthcoming statement by Trump's attorney Marc Kasowitz, though she did dispute at least one aspect of Comey's testimony. "I can definitely say the president is not a liar," Sanders said, calling the question "insulting."

Sanders also said has "no idea" if there is a taping system in the White House.

After Trump suggested in a tweet there might be “tapes” of his conversations with James Comey, the former director said he moved to make aspects of his memos public by enlisting a friend, a Columbia Law School professor, to share the content of his own notes with a reporter.

Comey said he hoped news reports would prompt the appointment of a special counsel. Indeed, the Justice Department appointed Mueller as special counsel to oversee the Russia probe just one day after the existence of the memos was disclosed.

Notably, Comey said Trump made several public statements that were false after he was fired. Among them, Comey said, was the president's denial at a White House news conference last month that he ever asked the FBI inquiry into Flynn to be shut down.

Comey also said Trump “defamed me and the FBI’’ after the president dismissed him last month. "Those were lies, plain and simple, and I am so sorry the FBI workforce had to hear them, and the American people were told them," Comey said.

Committee chairman Richard Burr, R-N.C. said it's important for Americans to hear Comey's story. "The American people need to hear your side of the story, just as they need to hear the President’s description of events," Burr said in his opening statement.

After the hearing, Burr said, "this is nowhere near the end of our investigation"

He said he is more confident now that the committee can work together in a bipartisan way to conduct its overall investigation of Russian interference in the 2016 election. In addition to the FBI investigation, there are now four congressional panels conducting their own probes into Russia's campaign of cyberattacks and fake news to undermine the election and possible coordination between Moscow and Trump associates.

Virginia Sen. Mark Warner, the top Democrat on the Senate panel, said: "The most important message I hope all Americans will take home is recognizing how significant the Russian interference in our democracy was. And that we've got to be in a better defensive position next year."

Warner described Comey’s prepared testimony as “disturbing.’’

"I do want to emphasize what is happening here,’" Warner said in a statement Thursday. "The president of the United States is asking the FBI director to drop an ongoing investigation into the president’s former National Security Advisor."

"In further violation of clear guidelines put in place after Watergate to prevent any whiff of political interference by the White House into FBI investigations, the president then called the FBI director on two separate occasions (March 30 and April 11) and asked him to ‘lift the cloud’ of the Russia investigation," Warner said.

Warner also cited Trump’s request for “loyalty’’ at a Jan. 27 dinner as particularly troubling.

Comey's written testimony described how president told him at that dinner, "I need loyalty. I expect loyalty."

"I didn’t move, speak or change my facial expression in any way during the awkward silence that followed," Comey said of the exchange.

Several Republican senators attempted to take the focus of the hearing off of Trump, asking Comey questions about his investigation last year of Hillary Clinton's use of an email server while she was secretary of State.

Trump's defenders pointed to Comey's statement to underscore the president's assertion that the former director had assured him that he wasn't under investigation as part of the Russia probe.

Comey's statement says that he told Trump at their first meeting on Jan. 6 in New York City that the FBI wasn't investigating him personally.

"Prior to the January 6 meeting, I discussed with the FBI’s leadership team whether I should be prepared to assure President-Elect Trump that we were not investigating him personally. That was true; we did not have an open counter-intelligence case on him," Comey said in his statement. "We agreed I should do so if circumstances warranted. During our one-on-one meeting at Trump Tower, based on President Elect Trump’s reaction to the briefing and without him directly asking the question, I offered that assurance."

Trump's lawyer said that was a public acknowledgement that Trump "was not under investigation in any Russian probe.''

"The President feels completely and totally vindicated,'' Trump attorney Marc Kasowitz said in a written statement Wednesday. "He is eager to continue to move forward with his agenda.''

Comey's testimony has become a huge political spectacle, attracting crowds at the Capitol and at bars showing the event live.

Spectators, most of them young congressional staffers, began lining up outside the Senate Intelligence Committee's hearing room hours before the doors opened. Seven folding tables reserved spots for more than 100 reporters were positioned just behind the witness table.

Photos: Fired FBI Director James Comey testifies on Capitol Hill

Photos: A look at Former FBI Director James Comey's career

Among the group of Comey supporters seated just behind the witness table was former Manhattan U.S. Attorney Preet Bharara. Earlier this year, Bharara was famously fired by Trump during an abrupt purge of top Justice Department prosecutors.

Comey was scheduled to meet in closed session with the Senate Intelligence Committee on Thursday afternoon.