Former FBI Director James Comey said Thursday that he shared his record of an explosive conversation with President Donald Trump, thinking it may "prompt the appointment of a special counsel" to the FBI's Russia investigation.

Comey told the Senate Intelligence Committee he came away from the February meeting with the impression that Trump was ordering him to drop the ongoing investigation into ex-national security advisor Michael Flynn and his links to Moscow.

After Trump warned on Twitter that he may have "tapes" of that conversation, Comey passed along the memo to a friend at Columbia Law School. The content of the talk was subsequently reported in The New York Times.

Comey told the Senate Intelligence Committee on Thursday:

"The president tweeted on Friday after I got fired that I better hope there's not tapes. I woke up in the middle of the night on Monday night 'cause it didn't dawn on me originally that there might be corroboration for our conversation. There might be a tape. And my judgment was I needed to get that out into the public square. So I asked a friend of mine to share the content of the memo with a reporter. I didn't do it myself for a variety of reasons, but I asked him to because I thought that might prompt the appointment of a special counsel."

The Justice Department later appointed former FBI Director Robert Mueller as special counsel overseeing the probe into Russian interference in the 2016 election and the extent of ties between the Trump campaign and the Kremlin.

Comey described the person he shared with as "a good friend of mine who's a professor at Columbia Law School."

Daniel Richman, a former federal prosecutor and professor at the school, confirmed to CNBC that he was the friend Comey described. Richman is listed on Columbia Law School's website as an adviser to Comey.

Trump's outside counsel Marc Kasowitz claimed later Thursday that it was an "unauthorized disclosure of privileged information" that "appears to be entirely retaliatory."

In Senate testimony, Comey said he wrote records of his conversations with Trump "immediately" after they took place — something he did not do with Trump's predecessor President Barack Obama — because he was concerned Trump might "lie."

Comey also said he took steps to ensure he wrote the memos in a way that it would not be necessary to label them as classified.

That shows the former FBI chief thought seriously about the consequences when he met with Trump, according to Jeffrey Cramer, a former assistant U.S. attorney for the Northern District of Illinois.

"Comey was thinking three steps ahead of the president by writing the memo and ensuring it couldn't be labeled classified," he said.