Image copyright Twitter/ Sean Hannity Image caption Sean Hannity (left) and Michael Cohen
A Fox News host is the mystery third client of US President Donald Trump's lawyer, a court has heard.
A judge ruled that Michael Cohen, the president's personal attorney, must reveal the link to Sean Hannity.
Monday's hearing in New York City follows an FBI raid this month on the presidential lawyer's home and office, which Mr Hannity has called an anti-Trump "witch hunt".
A vocal Trump advocate, Mr Hannity denied he was a client of Mr Cohen.
The conservative host, who is known for passionately defending Mr Trump on his Fox News show against what he describes as biased attacks by the media, had never previously divulged any legal ties to the president's attorney.
What is the court case about?
FBI agents who raided Mr Cohen's home and evidence were looking evidence on various matters, including a $130,000 (£90,000) payment made to adult-film actress Stormy Daniels, who alleges she had an affair with Mr Trump and was paid "hush money".
Monday saw the judge deny Mr Cohen's attempts to prevent prosecutors from reviewing the materials seized in the FBI raids.
Mr Trump's attorney says the computers, phones and documents should be protected under attorney-client privilege.
But Judge Kimba Wood ruled his application for a preliminary injunction was premature.
The judge allowed prosecutors to proceed with the cataloguing of evidence seized in the raids while a system is set up to ensure that records protected by attorney-client privilege are not disclosed to investigators.
But she will also consider appointing a "special master" to play a supervisory role in the process.
More on Sean Hannity:
Advertisers desert embattled Fox host
ABC star's 'gay insult' in Fox News spat
How did Hannity's name come up?
Image copyright Getty Images Image caption Mr Hannity frequently visits the White House
Just before Monday's hearing, Mr Cohen said in a statement that he had only provided advice to three clients in the past year.
One was Mr Trump. Another was a Republican fundraiser who admitted to paying a former Playboy model after she became pregnant during their affair.
The third client, Mr Cohen said, had refused to give him permission to be publicly named.
But Judge Wood made one of the lawyers identify Mr Hannity on Monday.
There were gasps and some laughter in the courtroom after the announcement, and some journalists raced out of the courtroom to report the revelation.
Skip Twitter post by @seanhannity In response to some wild speculation, let me make clear that I did not ask Michael Cohen to bring this proceeding on my behalf, I have no personal interest in this proceeding, and, in fact, asked that my de minimis discussions with Michael Cohen, — Sean Hannity (@seanhannity) April 16, 2018 Report
Mr Hannity later issued a statement of denial.
"Michael Cohen has never represented me in any matter," the Fox host said.
"I have occasionally had brief discussions with him about legal questions about which I wanted his input and perspective.
"I assumed those conversations were confidential, but to be absolutely clear they never involved any matter between me and a third party."
In a post on Twitter, he said the advice "dealt almost exclusively" with real estate.
He maintained it was no "big deal".
After last week's raid on Mr Cohen's offices, Mr Hannity took to the airwaves to denounce the probe as a "declared war against the president of the United States".
Image copyright EPA Image caption Adult-film actress Stormy Daniels spoke to the media outside the federal court
Did Stormy Daniels make an appearance, and what is her role in the case?
Also in the Manhattan federal court was Ms Daniels, whose appearance triggered a scrum by photographers outside.
Mr Cohen has admitted making a payment to the adult film actress, who claims the money was to keep her quiet about an affair she says she had with Mr Trump in 2006.
Mr Trump's attorney says he made the payment just before the 2016 election, but maintains Mr Trump did not know about it.
He is facing a criminal inquiry, which the president has strongly criticised.
The payoff to Ms Daniels could amount to a campaign finance violation, say legal analysts.
The White House has denied Mr Trump had an extramarital affair.
Moments before Sean Hannity's radio show started on Monday, an astonishing story broke: Michael Cohen, President Donald Trump's personal attorney, revealed that Hannity was the third mystery client he had provided legal services to over the past year.
The news jolted through the media industry, prompting reporters to send a flood of emails and texts to Hannity requesting comment.
Hannity remarked that "everyone" was "going insane" and briefly teased journalists who had tuned into his radio program waiting for his reaction: "I'll just keep the media listening because they might learn something," he joked.
Finally, the Fox News host, who is one of Trump's top defenders on cable news, addressed the elephant in the room, himself appearing a bit in the dark on what had just happened.
Related: Michael Cohen's mystery third client is Sean Hannity
"I guess that Michael Cohen had to list the people that were, that he's done some work with or whatever," Hannity said. "I don't know what the full thing was that actually went on there."
"I have known Michael a long, long time," he continued. "And let me be very clear to the media: Michael never represented me in any matter, I never retained him in the traditional sense for retaining a lawyer, I never received an invoice from Michael, I never paid legal fees to Michael."
Hannity said he "occasionally had brief discussions about legal questions" with Cohen, and that he assumed those discussions were protected by attorney-client privilege. Hannity stressed that "not one of any issue" he ever dealt with Cohen on pertained to a matter between him and a third party.
Cohen previously disclosed that in the course of the past year he had represented three clients. Those included Trump and Elliot Broidy, the former Republican fundraiser who -- with the help of Cohen -- paid $1.6 million to a Playboy model with whom he had an affair and impregnated. But the third client Cohen had provided legal services to over the past year had remained a mystery until Monday's hearing when a judge forced him to reveal the person's identity.
Related: Stelter: Sean Hannity has few rules, and now Fox News has a problem
After explaining his relationship with Cohen, Hannity did what he does best: attacking the media.
Hannity characterized news organizations as going "off the rails" for reporting on his relationship with Cohen, saying that his relationship was not very complicated and questioning why the story was receiving the amount of attention it was.
"How did this blow up to be such a big deal?" he asked, adding it was "pretty unbelievable, the world we live in."
Chat with us in Facebook Messenger. Find out what's happening in the world as it unfolds.
2 U.S.
Black Harvard Student Is Punched by the Police During Arrest