When former FBI Director James Comey revealed that he orchestrated a disclosure of damaging details about his conversations with President Donald Trump, he demonstrated his savvy use of media and his skills as a Washington operator. He also kicked up a hornet's nest of questions about the legal and ethical implications of the move.

Trump's personal lawyer on Thursday made Comey's secret gambit a central piece of his defense of the president against the fired lawman's testimony. Attorney Marc Kasowitz claimed Comey made "unauthorized disclosures" of privileged communications. He said he would leave it to the "appropriate authorities" to determine whether Comey's plan should be investigated along with the leaks of material that have infuriated Trump.

But Comey seemed unconcerned about that prospect when he acknowledged the move earlier Thursday before a throng of cameras and a packed Senate intelligence committee hearing room.

With vivid detail, he told the panel when the idea dawned on him — "in the middle of the night" — and what moved him to act. He said he was reacting to Trump's cryptic tweet saying Comey better hope there are no tapes of their disputed conversations about the Russia investigation into election-season hacking. Comey said the president's message convinced him he needed to get his account, detailed in contemporaneous memos, out quickly.

"My judgment was, I needed to get that out into the public square. And so I asked a friend of mine to share the content of the memo with a reporter," Comey testified. "I asked him to, because I thought that might prompt the appointment of a special counsel."

The friend, who was later identified as Columbia University law professor Daniel Richman, read part of the memo to a reporter from The New York Times, according to the newspaper. The paper reported Trump had asked Comey to drop the investigation into former national security adviser Michael Flynn.

Kasowitz has denied that account, but he also argued that Comey's move "unilaterally and surreptitiously made unauthorized disclosures to the press of privileged communications with the president." He claimed that The New York Times quoted from the memo before Trump's tweet, although that is not born out by the timeline. Trump issued his warning online on May 12, three days after Comey was fired and four days before the newspaper reported on the information in the memo, which was recounted by Comey associates. A special counsel was appointed the following week.

James Comey
IBTPOTY2017 Pictures of the week

Comey contended that the material was not classified or protected.

Still, experts debated the legality of Comey's secret back channel. Jonathan Turley, a law professor at George Washington University, suggested it was at minimum unprofessional and possibly unethical or even illegal.

Turley contended that the memos were written in the style of the standardized forms agents use to summarize interviews, documents known as 302s, and were likely typed on an FBI computer and, therefore, could be considered government property. That would make stealing, selling or conveying it a crime, Turley said.

"This doesn't strike me as a daily diary," Turley said. "You don't keep your diary on an FBI computer and write passages during work hours about a work-related meeting. He knew he was preparing something that was evidentiary in nature."

Steven Aftergood, director of the Federation of American Scientists Project on Government Secrecy, disagreed. It's hard to view the memo as government property, and it was shared, not lost or stolen, so it would not likely qualify as a crime, he said. And Comey discussed the contents of the memo in an open congressional hearing, which means the material he shared with his friend would not have been classified, Aftergood said.

"At this point, Comey is not a government employee, and he is not under the direction of the president, and so I don't see a legal or procedural bar," Aftergood said. "He's being totally above board about it, and if anybody wants to say that's wrong, he is standing by his actions. If anybody wants to pursue him, he has made himself available, and that's the most anyone can ask for."

Comey's confirmation that he was behind the disclosure was not a shock to many in Washington. The lawman is known for understanding how to find the spotlight.

He defied FBI norms by making public pronouncements about the investigation into Hillary Clinton's use of a private email server, including during the campaign's final days, drawing the ire of those who believe he tipped the electoral scales to Trump.

That came nearly a decade after Comey, whom Trump recently derided as "a showboat," first stepped onto the national stage with testimony about his hospital visit with the attorney general to prevent the reauthorization of a domestic surveillance program.

That he would have another star turn came with little surprise, according to Tobe Berkovitz, a political media consultant who now teaches at Boston University.

"He absolutely knows what levers to pull, when to pull them, how things are going to play," said Berkovitz. "He's very clear about his own image and persona and clearly revels in the media spotlight."