Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Sean Hannity, the Fox News host who has been waging war on the air against special counsel Robert Mueller and is an outspoken advocate for President Donald Trump, was revealed Monday as one of only three clients that Michael Cohen, the president's personal attorney, had during 2017 and 2018.

In a court filing earlier in the day, Cohen had sought to shield Hannity's name from becoming public. Cohen said he had three clients: Trump; Elliott Broidy, the former deputy finance chairman of the Republican National Committee, who impregnated and then paid a woman with whom he had an affair; and a third party that Cohen said did not want to be identified.

During Monday’s proceedings, U.S. District Judge Kimba Wood ordered Cohen’s attorney to disclose the client's identity. The client is Hannity, Cohen's lawyer said.

It is not known why Cohen was representing Hannity.

Hannity addressed the news on his AM radio show, claiming that while he never retained Cohen in the "traditional" sense, they still had attorney-client privilege.

"Michael never represented me in any matter, I never retained him in the traditional sense as retaining a lawyer, I never received an invoice from Michael, I never paid legal fees to Michael," Hannity said, before adding, "We definitely had attorney client privilege because I asked him for that but, you know, he never sent me a bill or an invoice or did I actually officially retain him."

Hannity also said that he "might have handed him 10 bucks."

Later Monday afternoon, Hannity tweeted that he "assumed" his conversations with Cohen "were confidential, but to be absolutely clear they never involved any matter between me and a third-party." He said the discussions were "almost exclusively about real estate."

Michael Cohen has never represented me in any matter. I never retained him, received an invoice, or paid legal fees. I have occasionally had brief discussions with him about legal questions about which I wanted his input and perspective. — Sean Hannity (@seanhannity) April 16, 2018

The TV host has been a consistent backer of Trump, both on-air and off, and has repeatedly blasted Mueller’s investigation into Russian interference in the 2016 election. He has also frequently defended Cohen in the days since the FBI raided Cohen's home and office.

"As I have been warning, Mueller is out to get the president and it appears at any cost," Hannity said last Monday on his Fox News program, hours after news of the raid broke.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

“Now keep in mind, Cohen was never part of the Trump administration, or the Trump campaign,” he said then. "This is now officially an all-hand-on-deck effort to malign, and if possible, impeach the president of the United States."

On the next evening's show, he slammed the FBI's raid as "an unprecedented abuse of power." The next day, he called it "highly questionable."

Until now, Hannity had not disclosed that he had a relationship with Cohen during his radio show or television program.

The @MichaelCohen212, executive VP to @realDonaldTrump joined me in studio today to discuss the #TrumpPhenomenon pic.twitter.com/reEaksFaX4 — Sean Hannity (@seanhannity) August 10, 2015

Ethics experts immediately questioned why he, or Fox News, hadn’t previously revealed the tie.

“Why doesn’t @FoxNews have a conflict of interest policy requiring Hannity to disclose his personal interest in the Cohen search when commenting on it?” tweeted Walter Shaub, the former director of the independent Office of Government Ethics.

A spokesperson for Fox News did not immediately respond to questions from NBC News about the relationship between Hannity and Cohen.

Monday's legal proceedings stemmed from a motion for a temporary restraining order under which Cohen had sought to stop federal investigators from reviewing materials seized in a search warrant last week.

Wood denied that motion during Monday's hearing.

She also did not rule out the possibility of using a "privilege team," also known as a "taint team,” which would review which of the seized materials are considered privileged through attorney-client privilege, and which materials can be turned over to the potential trial prosecutors and federal agents.

"I have faith in the Southern District Attorney's Office. Their integrity is unimpeachable. I think a taint team is a viable option," Wood said.

Until Wood makes a decision on a "taint team," the U.S. government will have to produce the documents they seized on a rolling basis to opposing counsel, meaning they will have to share with Cohen's team what they found.

During the hearing, Trump’s attorney, Joanna Hendon, said that Trump, as the "owner" of the privilege, is entitled to first review of the materials seized from Cohen.

Assistant U.S. Attorney Thomas McKay responded that "just because he (Cohen) has a powerful client doesn’t make him entitled to special treatment."

Monday's hearing included direct references to Trump by lawyers for the government. At one point, McKay said that "inflammatory remarks about the case" made by Cohen and by Trump were "drumming up" media attention.

The specific focus of the investigation and possible federal crimes have not been disclosed by the U.S. attorney’s office, but in a filing on Friday they do confirm Cohen is under federal criminal investigation. Federal prosecutors said in a court filing Friday the investigation that led them to raid Cohen's offices "largely centers on his personal business dealings" and has been going on for months. However, Wood said Monday that the search warrant would remain sealed.

Stormy Daniels, who claims she had an affair with Trump in 2006, attended the court proceedings.

FBI agents seized documents and devices in raids last week on Cohen's office and hotel room, seeking information about payments made to Daniels shortly before the 2016 election. A letter that Cohen's lawyers sent to the court on Monday morning states that more than a dozen electronic devices and other items were seized.

Daniels alleges she had a sexual encounter with Trump in 2006. The White House and Cohen have denied that claim.

Cohen, 51, has denied wrongdoing. Trump has blasted the raid, calling it "an attack on our country" while reiterating his view that Mueller's investigation is a "witch hunt" and a "disgrace."

Trump last week broke his silence on the Daniels case, saying he was not aware of the payment made by Cohen to the porn actress just days before he was elected. The president also said he did not know where the $130,000 came from. Cohen has said it came out of his own pocket.