Anthony Weiner was sentenced to 21 months in prison on Monday for sexting with a 15-year-old high school student.

Weiner, a former Democratic congressman from New York, was sentenced by a federal judge in Manhatten. The judge also sentenced Weiner to three years of supervised release after he serves in prison, and fined him $10,000.

He must surrender to prison by Nov. 6.

According to the Associated Press, Weiner held his head in his hands and cried as the judge delivered the sentence.

"This is a serious crime that deserves serious punishment," U.S. District Judge Denise Cote said during the sentencing.

The 53-year-old pleaded guilty in May to one count of transferring obscene material to a minor. Weiner sent a 15-year-old from North Carolina obscene messages, including adult pornography, during several conversations on online video chat and messaging platforms last year. He convinced the teenager to take her clothes off for him via Skype, despite her telling Weiner she was in high school, and sent her a message telling her "what he would do to her if she were 18," according to court filings.

Federal prosecutors asked the judge to sentence Weiner to just over two years in prison, but the former congressman asked for probation. In a statement in May, Weiner said his sexting was part of a "sickness" he has since sought "intensive treatment" for.

Weiner has a history of sending lewd photos and images to women, and his indiscretions ultimately led him to resign from Congress in 2011.

His actions eventually led his wife, Huma Abedin, to file for divorce in May. Abedin served as one of Hillary Clinton's closest aides, and it was her husband's messages with the 15-year-old that led the FBI to re-open its investigation into Clinton's use of a private email server just before the November election.

During the bureau's probe into Weiner's conduct, agents discovered Abedin had forwarded emails to her husband's computer. The discovery led former FBI Director James Comey to announce the FBI would be re-opening its investigation into Clinton's emails, though nothing new was found in the messages.

Clinton said Comey's announcement about the email investigation likely cost her the race.