Martin Shkreli, who was convicted of three counts of securities fraud on Aug. 4, will now await his January 2018 sentencing hearing in jail. (Monica Akhtar/The Washington Post)

For Martin Shkreli, the acts of ridiculing and trolling weren’t just a solitary hobby. They were a performance for the benefit of his small army of online fans, who loved watching their favorite Internet supervillain get away with it.

This time it cost him.

The former drug executive has taunted opposing prosecutors, mocked members of Congress and harassed journalists who have covered him. The day after he was first arrested, Shkreli live-streamed himself alone in his apartment, chatting for hours with the hundreds who joined to cheer him on.

He first gained notoriety in 2015 for hiking by 5,000 percent the price of a vital AIDS medication that his pharmaceutical company manufactured, earning the nickname “pharma bro.”

He became reviled for the very same behaviors his superfans cheer on: his cocksure displays of immaturity and indifference, and for exuding the impression that he was somehow, always, above reproach.

But on Wednesday, U.S. District Judge Kiyo Matsumoto in New York ordered Shkreli sent to jail, having deemed him a danger to the community after offering his Facebook followers $5,000 for a strand of hair from former Democratic presidential candidate Hillary Clinton.

Shkreli, who faces up to 20 years in prison for defrauding investors, was free on $5 million bail after his conviction in August. He apologized, saying that he did not expect anyone to take his online comments seriously.

In his defense, Shkreli’s legal team used a version of the same refrain he’s always used to explain his behavior online: that he wasn’t really serious. Essentially, he’s invoking Poe’s law, the old Internet rule that has to do with the impossibility of proving whether an extreme statement online is earnest or ironic unless you truly know the author’s intent.

Martin Shkreli, who was convicted of three counts of securities fraud on Aug. 4, will now await his January 2018 sentencing hearing in jail. (Monica Akhtar/The Washington Post)

In recent years, a version of this rule has become the go-to defense for abusive or offensive online behavior: the claim that it was all just a joke, one that the victim is failing to appreciate. But in this case, Matsumoto wasn’t buying it.

Here’s a look back at Shkreli’s history of ridiculing and trolling:

A love of live-streaming

Shkreli has a habit of live-streaming to his fans after major events in his trial. A day after posting bail following his initial arrest in December 2015, Shkreli spent hours live-streaming, alone, in his apartment. At one point, showing a full view of his computer screen to his viewers, he began to browse the OkCupid dating site, streaming to hundreds of strangers the photos, profiles and messages he could see.

He did it again in August, after he was convicted.

While streaming to his fans that day, Shkreli invited a journalist into his apartment who, unbeknownst to her, conducted an interview on camera. When Shkreli failed to secure the anti-media “gotcha” moment his fans were anticipating, the commenters in his live-streamed chatroom resorted to making disparaging comments about the reporter’s appearance.

When Shkreli isn’t streaming himself commenting on the legal proceedings against him, he streams investment seminars to his fans.

Mocking prosecutors

Shkreli’s outspoken nature has led to a clash with Matsumoto before. During his trial for securities fraud this summer, the millionaire called prosecutors from the Eastern District of New York in Brooklyn the “junior varsity” to Manhattan prosecutors in front of a room of reporters.

At the time, the judge said she was shocked by the comments. “Any juror could have heard them.” And she ordered him to stop speaking to the media.

“This isn’t going to help Mr. Shkreli in the end. He is risking exposure in the media” that could harm him, Matsumoto said.

Shkreli apologized, but after the verdict he returned to social media.

Badgering Congress

Shkreli responded to a call to testify before a congressional committee in February of this year with his practiced persona. Before the hearing, he promised to “school Congress.”

“I would love to talk to Congress. I would berate them. I would insult them,” he said, according to Bloomberg News.

It was classic Shkreli, The Post’s Amber Phillips wrote: “bold, unapologetic, brash, arrogant.”

But at the hearing on prescription drug price-gouging, the disgraced former drug executive suddenly, and uncharacteristically, shut his mouth, pleading the Fifth Amendment with a smirk.

But he was back at it after he was dismissed.

“Hard to accept that these imbeciles represent the people in our government,” Shkreli tweeted.

Attacking journalists

Shkreli has attacked the journalists who criticize him with a barrage of trolling tactics. One of them: buying the domains associated with the names of reporters he doesn’t like and posting disparaging messages about them on the page, as Business Insider recently reported. He eventually offers to sell those domains for an exorbitant price.

Selling www.emilysaul.com and www.megtirrell.com to raise money for my debut album: "God's Gift: The Album". I bought these domains for $12 – you can have them for $12,000. Tryna to get that Future feature doe

Posted by Martin Shkreli on Tuesday, June 27, 2017

He’s displayed a particular determination for harassing journalists who are women.

In January, Shkreli was suspended from Twitter for the “targeted harassment” of Teen Vogue writer Lauren Duca. After repeatedly sending Duca unwelcome messages and tweets, he changed the background image of his own Twitter page to a Photoshopped image of him and Duca embracing. The photo was originally a personal photo; Shkreli had Photoshopped his own face onto the head of Duca’s boyfriend.

Even off Twitter, this behavior has continued.

The day before the trial, he was reported as saying he planned to “f—” her if acquitted.

He has mentioned her on his Facebook page repeatedly since the verdict.

Read more:

‘Racism is as American as baseball’ banner hung on Green Monster during Red Sox game

After @tedcruz liked a porn tweet, Sen. Ted Cruz blamed it on a staffer’s ‘honest mistake’