Martin Shkreli could spend 20 years in prison for defrauding investors. (Seth Wenig/AP)

NEW YORK — A federal judge on Friday rejected a motion by Martin Shkreli to throw out some of the securities-fraud charges a jury convicted him of last year, leaving the infamous former hedge fund manager still at risk of spending 20 years in prison for defrauding investors.

The evidence in the case “was more than sufficient” to warrant a conviction on the charges, Judge Kiyo Matsumoto said.

Shkreli, 34, best known for raising the price of an AIDS drug by 5,000 percent when he was chief executive of Turing Pharmaceuticals, was convicted by a Brooklyn jury in August of defrauding the investors in his hedge funds. Shkreli lied to obtain investors’ money, then didn’t tell them when he made a bad stock bet that led to massive losses, prosecutors argued. Instead, they said, he raised more money to pay off other investors, or took money and stock from Retrophin, a drug company that he was running.

Shkreli’s defense attorneys have argued that Shkreli’s investors eventually made money and said Friday that the jury erred by convicting Shkreli on some of the counts he faced. Matsumoto said she would reject that motion.

This marked the first time Shkreli has appeared in court since September, when Matsumoto revoked his $5 million bail. Prosecutors had complained that Shkreli’s out-of-court antics posed a danger to the community and that he was harassing women online. In court Friday, the willowy former hedge fund executive sported a light beard and wore a dark-blue prison uniform. He appeared in good spirits, smiling at his attorneys and waving to family members and friends in the courtroom.

“Under the circumstances, I think he’s doing remarkably well,” Shkreli attorney Benjamin Brafman told reporters after the hour-long hearing.

Despite his incarceration, Shkreli has managed to keep up an online presence. A friend often updates his Facebook page with comments about chronic illness, biotechnology companies and even politics. When the Republican tax bill passed the Senate in December, Shkreli’s Facebook account was updated with a comment calling the Democrats who voted against the measure “LOOSERS.”

“Shrink the government, drain the swamp, give the people their money and freedom,” the post said in a tone typical of Shkreli.

The judge has scheduled a March 9 hearing to decide on Shkreli’s sentence.

In the meantime, Shkreli’s attorneys and prosecutors are still arguing over how much money he should have to forfeit after his conviction. Shkreli is worth more than $27 million, including his stake in Vyera Pharmaceuticals, formerly Turing, a Picasso and the only known copy of a Wu-Tang Clan album. He should give up $7.4 million of that based on the charges he faced, prosecutors say.

Shkreli’s defense attorneys say he owes nothing since his investors ultimately made money and Shkreli did not intend to defraud them. Shkreli did not use the money he received from investors “to support a lavish lifestyle,” Brafman said. He was not motivated by greed, Brafman said, but by being a success. “These people made a lot of money,” Brafman said of Shkreli’s investors.

But prosecutors said Shkreli used the money to perpetuate a lie: that he was a success. “He did in fact take that money to perpetuate a fraud … a desire to make him look like a successful hedge fund manager, when he was not,” said Assistant U.S. Attorney Alexandra Smith. Investors’ money was used to pay for Shkreli’s meals, cab rides and even Jay-Z concert tickets, all of which helped maintain the illusion of his success, she said.

The judge did not immediately rule on that issue. Her decision could be a significant sign of the severity of the sentence Shkreli could ultimately face.