Matsumoto said she didn't find anything funny about either Shkreli's posts about Clinton, or his online boasts during his trial in July that he would get to "f---" a female journalist with whom he has feuded since January, as well as a female political pundit, once his trial ended.

"It is clearly beyond any reasonable doubt that Mr. Shkreli is a danger to the community. He's not special, by any stretch of the imagination," Kasulis said.

"He is reckless. He knows exactly what he is doing. He needs to go in," Kasulis said to a packed courtroom that included Shkreli's father.

Federal prosecutor Jacquelyn Kasulis, who appeared to be seething about the disgraced pharmaceutical executive's posts about Clinton and other women, said Wednesday, "I think this escalating pattern of violence against women is incredibly disturbing."

"It's not going to happen again," Brafman vowed about his client, who has a long history of baiting adversaries online. "I'm asking you ... to give him a chance to be more appropriate."

And it came a day after Shkreli, 34, apologized for posting a $5,000 bounty last week to any of his 70,000 Facebook followers who grabbed some of Clinton's hair, saying he used "poor judgment" with "my awkward attempt at humor."

Judge Kiyo Matsumoto's ruling came at a hearing in Brooklyn federal court where Shkreli's high-powered lawyer Benjamin Brafman pleaded with her for nearly an hour not to toss him in jail despite what the attorney said was a "stupid" Facebook post.

An angry federal judge revoked the $5 million bond of convicted fraudster Martin Shkreli on Wednesday and ordered him jailed after ruling the notorious "pharma bro" was a danger to the public because of his offer on Facebook of cash for samples of Hillary Clinton's hair.

"He is soliciting an assault on another person for $5,000," Matsumoto said. The judge noted that no one knew whether any of Shkreli's followers would take him up on that bizarre offer, either in a legitimate desire for the cash or in a bid to gain Shkreli's approval.

She noted that even when Shkreli tried to portray the offer as satire in a subsequent Facebook post, he wrote that he would pay the bounty only if the hair included a follicle.

"The fact that he continues to remain unaware ... of the inappropriateness of his actions or words demonstrates to me he may be an ongoing danger or risk to the community," Matsumoto said.

The judge also noted that once defendants are convicted in federal court, as Shkreli was in August, there is a legal presumption that their bail will be revoked.

"I''m going to remand Mr. Shkreli," Mastumoto said.

A somber-looking Shkreli, wearing a purple dress shirt and a shaggy mop of hair, was taken into custody by two deputy U.S. Marshals just after 6 p.m. ET as his grim-faced legal team stood by.

"We are obviously disappointed," Brafman said outside the court to reporters. "We believe the court arrived at the wrong decision but she's the judge and right now we will have to live with this decision."

"It's unfortunate. It was unfortunately avoidable, but the judge has ruled and she's the judge," the lawyer said.

Shkreli will be held in a federal jail, the Metropolitan Detention Center in Brooklyn, New York, until his sentencing on securities fraud charges on January 16, which Matsumoto scheduled Wednesday.

Shkreli's Facebook post last week about Clinton sparked an inquiry from the U.S. Secret Service, who also in response beefed up their protective measures for the former secretary of state and 2016 Democratic presidential nominee amid her ongoing book tour.

Prosecutors then asked Matsumoto to jail Shkreli, saying in a court filing that "his recent public conduct demonstrates that he cannot meet his post-trial burden to show, by clear and convincing evidence, that he does not pose a danger to the community."

Prosecutors pointed out that Shkreli's latest stunt came just weeks after being convicted of three securities fraud-related counts in Brooklyn federal court.

Brafman, at Wednesday's hearing, used a slew of arguments to dissuade Matsumoto from revoking Shkreli's bond, as she appeared inclined to do almost from the moment that she took the bench.

"I'm not making excuses for Mr. Shkreli," Brafman said. "We had a long, painful discussion about this episode."

"I'm angry at him too," the lawyer said.

Brafman said Shkreli never intended for his post to be taken seriously, noting that Shkreli had also written about using the hair to "clone" Clinton, and that he was dismayed to find out that people might believe otherwise.

"Stupid doesn't make you violent," Brafman said.

Brafman suggested however that Shkreli — a purported supporter of President Donald Trump with a long-standing animus to Clinton — was merely engaging in the sort of scathing political hyperbole that has become increasingly common in America. Brafman said that kind of speech, no matter how offensive, is constitutionally protected.

The lawyer also argued that Shkreli had been lashing out on social media in response to being demonized by the public in the past two years after raising the price of an anti-parasite drug by 5,000 percent in 2015.

Brafman offered to have Shkreli make a full-throated disavowal of this Clinton bounty online on Wednesday, to be willingly banned from all social media by the judge, and to generally behave appropriately from now on until he is sentenced.

He kept arguing his points for nearly 20 minutes after Matsumoto first said she would revoke Shkreli's bond, in an increasingly desperate effort to get the judge to change her mind.

In a letter to Matsumoto on Tuesday, Shkreli had written, "I wanted to personally apologize to this Court and my lawyers for the aggravation that my recent postings have caused."

"I understand now that some may have read my comments about Mrs. Clinton as threatening, when that was never my intention when making those comments," Shkreli wrote.

"I used poor judgment but never intended to cause alarm or promote any act of violence whatsoever," he wrote, adding that he had quickly amended his post to make clear he had just been joking.

Shkreli's lawyer Brafman, in his own letter to Matsumoto on Tuesday, had written, "While we do not condone Mr. Shkreli's comment, his constitutionally protected political hyperbole does not rise to the level of making a 'danger to the community' when he is not and has never been considered to be a danger."

Brafman said that Shkreli should not be jailed because he "never intended any harm or violence."

The lawyer disputed prosecutors' contention that comments Shkreli made online about Clinton and a journalist, Lauren Duca, constituted an escalating pattern of threats.

Brafman suggested that Shkreli was engaging in "political hyperbole" or "satire" in his comments about both women.

Brafman cited the fact that comedian Kathy Griffin was not prosecuted after she posted online a photograph of herself holding what appeared to be the bloody, severed head of Trump.

"Another example of political hyperbole is when President Donald Trump, as a candidate, caused a controversy last year by implying that 'Second Amendment people' could prevent former Secretary Clinton from abolishing their right to bear arms."

Michael Bachner, a leading New York criminal defense lawyer, earlier Wednesday told CNBC he did not believe Shkreli should have his bail revoked.

"If he had made the comments about another author who wasn't Clinton, I don't think there would be a bail revocation hearing going on here," said Bachner.

Another top New York lawyer, Gerald Lefcourt, earlier said that while Shkreli probably should be allowed to remain free on bail, "I think the judge is probably at wit's end with respect to... his conduct."

Matsumoto, during Shkreli's trial this summer, imposed a virtual gag order on him that barred him from talking about the case in public around the courthouse after he gave an impromptu press conference to reporters and called prosecutors in the case the "junior varsity."

Asked if he had ever seen a defendant in a criminal case who had been convicted make such a public spectacle of himself as Shkreli has done since early August, Lefcourt said, "No."

"He is just incapable of controlling himself," Lefcourt said.

CORRECTION: This story was updated to reflect the correct spelling of Martin Shkreli's name.