From his Fox News pulpit, Sean Hannity has been one of the most ardent supporters of President Trump, cheering his agenda and excoriating his enemies.
He has gone from giving advice on messaging and strategy to Mr. Trump and his advisers during the 2016 campaign to dining with him at the White House and Mar-a-Lago.
Now, Mr. Hannity finds himself aligned even more closely with the president.
During a hearing at a packed courtroom in Lower Manhattan on Monday, he was named as a client of Mr. Trump’s longtime personal lawyer and fixer, Michael D. Cohen.
That revelation nudged the conservative commentator into the orbit of those who have lately come under legal scrutiny related to the investigations of Mr. Trump and his associates by the special counsel, Robert S. Mueller III, and the United States attorney’s office in Manhattan. Both inquiries have provided fodder for Mr. Hannity’s prime-time cable show and nationally syndicated radio program.
The host’s closeness with the president may not sit well with media watchdogs, but the cozy relationship has been good for the Hannity business: “Hannity” is the most-watched cable news program, averaging 3.2 million viewers in the first quarter of 2018, up from 1.8 million in the early months of 2016.
The courtroom disclosure about Mr. Hannity occurred during the expanding criminal investigation into Mr. Cohen by the United States attorney’s office in Manhattan. F.B.I. agents raided Mr. Cohen’s home, office and hotel room on the morning of April 9, a move that President Trump called an “attack on our country.”
In a legal filing before the hearing on Monday, Mr. Cohen said that, since 2017, he had worked as a lawyer for 10 clients, seven of whom he served by providing “strategic advice and business consulting.” The other three comprised President Trump, the Republican fund-raiser Elliott Broidy and a third person who went unnamed.
The mystery was solved when Kimba M. Wood, a judge for the United States District Court for the Southern District of New York, ordered that Mr. Cohen’s lawyer, Stephen Ryan, disclose the name of the client in question — who turned out to be Mr. Hannity.
Mr. Hannity denied on Monday that he was a client of Mr. Cohen’s, saying that he had never paid him for his services and that his discussions with him centered on real estate.
The surprise naming of Mr. Hannity took place after several minutes of back and forth among government representatives, members of Mr. Cohen’s legal team and Judge Wood.
Before the name was revealed, Mr. Ryan argued that the mystery client was a “prominent person” who wanted to keep his identity a secret because he would be “embarrassed” to be identified as having sought Mr. Cohen’s counsel.
Robert D. Balin, a lawyer for various media outlets, including The New York Times, CNN and others, interrupted the hearing to argue that embarrassment was not a sufficient cause to withhold a client’s name, and Judge Wood agreed.
After Mr. Hannity was named, there were audible gasps from the spectators.
The hearing on Monday resulted from a challenge by Mr. Cohen’s lawyers, who argued for the appointment of a “special master” to examine the records seized during the federal raid on April 9. The exact nature of Mr. Cohen’s work for Mr. Hannity is unclear.
On Fox News, the anchor Shepard Smith reported that his colleague had been named as a client of Mr. Cohen’s. He did so after other news outlets had broken the story, saying that it was time for him to address “the elephant in the room.”
At roughly the same time, Mr. Hannity, on his radio show, said it was strange to see his name appearing on Fox News and wondered aloud if he should release a statement.
Just before 4 p.m., he posted a message on Twitter: “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.”
In a follow-up tweet, Mr. Hannity added, “I assumed those conversations were confidential, but to be absolutely clear they never involved any matter between me and a third-party.”
The reference to a third party seemed to be an allusion to one of Mr. Cohen’s specialties: drawing up confidential settlements. The lawyer has acknowledged paying $130,000 to Stephanie Clifford, an adult-film actress known as Stormy Daniels, as part of a nondisclosure agreement to secure her silence soon before Election Day in 2016.
Last week, it came to light that Mr. Cohen had arranged for Mr. Broidy to pay $1.6 million to a former Playboy model, Shera Bechard, who became pregnant during an affair with Mr. Broidy. After the confidential deal became public, Mr. Broidy resigned from his post as a deputy finance chairman of the Republican Party.
After offering his initial statements on Mr. Cohen, Mr. Hannity returned to Twitter late Monday afternoon to provide some detail, saying that his “de minimis discussions with Michael Cohen” had been “almost exclusively about real estate.”
In the opening moments of “Hannity” on April 9 — the night of the F.B.I. raids on Mr. Cohen — Mr. Hannity, in high dudgeon, told his viewers to “keep in mind that Cohen was never part of the Trump administration or the Trump campaign.”
“This is now officially an all-hands-on-deck effort to totally malign and, if possible, impeach the president of the United States,” the host added.
Without mentioning his relationship with Mr. Cohen, he continued, “Now, what that means is, Mueller’s witch-hunt investigation is now a runaway train that is clearly careening off the tracks.”
There is on-air evidence that Mr. Hannity and Mr. Cohen go way back. In January 2017, shortly before the inaugural, Mr. Cohen was a guest on Mr. Hannity’s radio show. The host described him as Mr. Trump’s lawyer and then added, “Also, full disclosure: a personal friend of mine, long before this election ever started.”
Mr. Cohen shot back, “Well, there goes my reputation now, Sean.”
The chummy conversation took place shortly after the so-called Steele dossier suggested that Mr. Cohen had visited Prague, a claim that Mr. Cohen has denied. Amid guffaws, Mr. Hannity discussed Mr. Cohen’s alibi — that he had taken his 17-year-old-son to Los Angeles to meet with a baseball coach.
Mr. Hannity praised Mr. Cohen’s son as an “amazing pitcher, a talented pitcher.”
Before the chat was done, Mr. Cohen thanked Mr. Hannity, saying, “Sean, I got to be honest, in all fairness, you have been a beacon for Mr. Trump, for the campaign. It’s very rare that people thank you, because everybody is so busy, especially now with the transition. But on behalf of, obviously, Mr. Trump, the campaign, myself — you actually deserve a thank you.”
Amid the banter, the two mentioned talking with each other during late-night phone calls and discussed how Mr. Trump’s enemies would be gunning for him after he took the Oval Office.
“You and I have discussed this — they are going to try to destroy Donald Trump,” Mr. Hannity said.
“And I’m going to make this statement to your audience: There is no way in the world I’m going to let it happen,” Mr. Cohen replied.
There for Trump
Many years before Mr. Trump was a candidate, Mr. Hannity was there for him. In 2011, when Mr. Trump was making the media rounds to promote an unfounded conspiracy theory — the so-called birther theory — that President Obama had not been born in the United States, Mr. Hannity gave him a forum on his radio and television shows.
Years later, his enthusiasm had not cooled. “I’m not hiding the fact that I want Donald Trump to be the next president of the United States,” Mr. Hannity told Jim Rutenberg of The New York Times during the summer of 2016. After all, the Fox News host added, “I never claimed to be a journalist.”
As Election Day drew near, other conservatives turned their backs on Mr. Trump after the posting of the so-called “Access Hollywood” tape, during which the candidate rudely boasted of “grabbing” women by the genitals. That’s when Mr. Hannity sealed his bond with Mr. Trump by committing even more fully to him. Although conceding that Mr. Trump’s “words” were wrong, he quickly changed the subject to Bill Clinton, adding that the former president’s “actions” with women were “far worse.”
In the waning days of the campaign, when Barack and Michelle Obama were campaigning for Hillary Clinton, Mr. Hannity reprised the “birther” talk by offering to buy President Obama a plane ticket to Canada, Indonesia or Kenya.
Now the top ratings draw at Fox News, Mr. Hannity has been described by colleagues as enjoying free rein inside the network.
Some journalists there have grumbled about his friendly interviews with Mr. Trump. Mr. Smith, in an interview last month, said the network’s prime time commentators “don’t really have rules,” prompting Mr. Hannity to call him “clueless” and to declare his own show “REAL NEWS.”
The revelation of Mr. Hannity’s relationship with Mr. Cohen is likely to only ratchet those tensions higher.