But, "He told me, 'I'm not pleading guilty to something did not do,'" Brafman said.

Brafman said that he was bound ethically to see if the case could be resolved before going to trial to protect the interests of his client.

Brafman said Shkreli told him, "I would never plead guilty to something I did not do. ... We're going to trial."

An angry Benjamin Brafman, Shkreli's lead lawyer, said Shkreli "categorically" refused to even consider a plea deal with the prosecution, although Brafman conceded he himself had reached out to prosecutors about a potential deal.

Prosecutors said that fact, disclosed for the first time in Brooklyn, New York, federal court, contradicted Shkreli's claim to journalists last week that he never considered a plea offer. The terms of that offer, which presumably would have reduced Shkreli's punishment at sentencing, were not revealed.

Also Wednesday, prosecutors who sought to have Shkreli gagged from talking about the case revealed that Shkreli's defense team several times had approached prosecutors about potentially resolving the case with a guilty plea to avoid going to trial.

"I was shocked that there were these comments, these statements," said Judge Kiyo Matsumoto, referring to Shkreli's outbursts. "There's a great risk jurors will be exposed."

A federal judge Wednesday ordered "pharma bro" Martin Shkreli to stop commenting on his ongoing securities fraud trial in and around the public areas of a New York courthouse after Shkreli went on a five-minute rant to reporters last week.

Prosecutors, when they filed their gag order motion Monday night, wrote that they strongly suspected that Shkreli had resumed posting on the social media service Twitter, which had banned him earlier this year after he harassed a female journalist in a series of tweets.

Prosecutors wrote they believed Shkreli was using the new Twitter handle @BLMBro. That account's tweets did contain comments on the ongoing trial and were written in Shkreli's often-acerbic style.

Twitter suspended that account after the prosecution's motion was reported.

In gagging Shkreli, at least in and around court, Matsumoto indicated she was deeply troubled by Shkreli having walked into a courtroom occupied by several reporters last week and making comments on the case.

During that short visit, Shkreli blasted prosecutors, witnesses and the press.

Jacquelyn Kasulis, an assistant United States attorney, told Matsumoto on Wednesday morning that, "It is of utmost importance to us that we avoid the circus-like atmosphere that we have discussed."

Kasulis noted that when a CNBC reporter asked Brafman last Friday whether he was concerned about Shkreli's loose lips to the press, Shkreli interjected, referring to himself, "He can do what he wants."

The prosecutor said, "That is of real concern with us."

Matsumoto also said she was afraid that jurors in the trial would end up hearing what Shkreli said if he continued talking; she was particularly concerned that he spoke to reporters while walking out of court last week after his rant.

"All your client has to do is stop talking in the courthouse and around the perimeter of the courthouse," Matsumoto said. "This isn't going to help Mr. Shkreli in the end."

"I would like to so order the agreement that he will not make comments in the courthouse about the evidence and the witnesses and this also includes the perimeter roads," Matsumoto said.

"I think it's inappropriate and that all the work we've done to select 18 men and women to sit on the jury would be jeopardized if he continued to do this."

Brafman told the judge, "There will be no more commenting by Mr. Shkreli." The attorney also said Shkreli agreed to willingly keep quiet in the future.

"I think this is an isolated incident."

Brafman claimed that his client suffers from anxiety and was being baited by reporters and their allegedly unfair coverage of the case.