After the prosecution rested its case against Donald J. Trump on Monday, the defense began a simple mission: destroy the credibility of the prosecution’s star witness, Michael D. Cohen.
That tactic may not have paid off as expected, as the judge in the case almost immediately lost his patience with the defense’s witness, Robert J. Costello, a lawyer and fixture in New York’s legal world who once advised Mr. Cohen.
Shortly after Mr. Costello took the stand on Monday, prosecutors objected to a series of questions. When the judge sided with the prosecution, Mr. Costello muttered “jeez,” registering his dismay and irking the judge, Juan M. Merchan. Mr. Costello tried to walk back his remark, mumbling under his breath that he wanted to “strike” it from the record.
The testimony continued, but after a few more objections, Justice Merchan again grew frustrated with the witness. He dismissed the jury, and excoriated him: “If you don’t like my ruling, you don’t say, ‘jeez,’ and you don’t say, ‘strike it,’ because I’m the only one who can strike testimony in court,” he said, adding: “Are you staring me down?”
He then cleared the courtroom, dismissing reporters while allowing a group of Mr. Trump’s supporters to remain.
When onlookers left the room, according to a transcript, the judge told Mr. Costello that his conduct was “contemptuous” and said, “If you try to stare me down one more time I will remove you from the stand,” adding, to the defense lawyers, “I will strike his testimony, do you hear me?”
Mr. Costello asked, “Can I say something, please?” And Justice Merchan replied: “No. No. This is not a conversation.”
Mr. Costello has been around the New York legal world for decades and prides himself on not taking flack from anyone.
In 2018, Mr. Costello acted as Mr. Cohen’s back channel to Mr. Trump’s legal team. This role — which came by dint of Mr. Costello’s close ties to Mr. Trump’s personal lawyer at the time, Rudolph W. Giuliani — was mostly informal. Mr. Cohen never officially retained Mr. Costello or paid him a cent.
When questioning Mr. Cohen last week, the prosecution spotlighted his communications with Mr. Costello. Their emails and calls, Mr. Cohen said, left him with the impression that Mr. Costello was doing Mr. Trump’s bidding, delivering implicit instructions to, in the former fixer’s words, “stay in the fold, don’t flip, don’t speak.”
But Mr. Costello, a former federal prosecutor turned defense lawyer, disputes that characterization, and Mr. Cohen’s testimony opened the door for the defense to call him to tell the other side of the story.
After the unexpected break on Monday, Mr. Costello testified that he treated Mr. Cohen as a client and had only his interests at heart. He said he did not concern himself with Mr. Trump’s interests at that time. Prosecutors began cross-examining him before the jury was dismissed for the day just after 4:30 p.m.
Mr. Cohen, who pleaded guilty to federal charges in 2018, served more than a year behind bars. His crimes included orchestrating a hush-money payment to a porn star in the final days of the 2016 campaign, a deal at the center of the current state case against the former president. Mr. Cohen paid off the woman, Stormy Daniels, to silence her story of a sexual encounter with Mr. Trump.
The Cohen and Costello relationship began in the chaotic spring of 2018, after the F.B.I. searched Mr. Cohen’s home and office as part of the sprawling investigation.
They met through Jeffrey Citron, who was Mr. Costello’s law partner and Mr. Cohen’s acquaintance. Mr. Citron asked Mr. Cohen over email whether he wanted to connect with Mr. Costello and obtain “his insight into your situation, it would be my pleasure to arrange.” Mr. Cohen jumped at the offer: “I do. Can you connect me to him?”
When Mr. Trump hired Mr. Giuliani, Mr. Costello alerted Mr. Cohen to the potential upside: “I told you my relationship with Rudy which could be very very useful for you,” he wrote in an email. Mr. Cohen replied: “Great news.”
The records show that Mr. Costello pursued the relationship with Mr. Cohen.
As Mr. Costello lost patience, he wrote to Mr. Cohen complaining that he had “failed to communicate with me despite several text messages and emails.”
Mr. Costello also appeared to make a veiled reference to fear in Mr. Trump’s orbit that Mr. Cohen was poised to cooperate with prosecutors, writing: “We have continued our dialogue and need to bring you up to date concerning serious concerns on the part of our friends.”
Mr. Cohen was noncommittal. “When the right time comes, and now is not the right time, we will advance our conversations regarding this issue.”
But Mr. Cohen kept the channel open. For example, he sent Mr. Costello an article with the headline “Trump’s campaign to discredit Michael Cohen is already underway,” and added: “They are again on a bad path.”
And when Mr. Cohen’s relationship with Mr. Trump soured in summer 2018, he asked Mr. Costello to use Mr. Giuliani as a conduit for his assurances that he would remain loyal to Mr. Trump, according to Mr. Costello.
After Mr. Costello relayed the message, he told Mr. Cohen in an email that he had “conveyed all of your expressed concerns” to Mr. Giuliani “for transmission to his client” — the president. Mr. Cohen replied, thanking him.
Mr. Costello has said he was merely relaying messages from Mr. Trump’s legal team, including Mr. Giuliani, a former New York mayor. (Mr. Costello later represented Mr. Giuliani in criminal and congressional investigations.)
In one email to Mr. Cohen, Mr. Costello wrote, “Sleep well tonight, you have friends in high places.”
But in the end, no one remained friends, and much of the tension stemmed from money.
Mr. Costello and Mr. Cohen had a falling out, partly over unpaid legal bills. Last year, Mr. Costello testified before the grand jury that ultimately indicted Mr. Trump, seeking to undercut Mr. Cohen’s credibility.
Mr. Costello also sued Mr. Giuliani over delinquent bills.
And when Mr. Trump stopped paying Mr. Cohen’s legal fees, their relationship imploded as well. Mr. Cohen vowed to turn on Mr. Trump, a promise he is now fulfilling on the stand.