Former New York Democratic Congressman Anthony Weiner was sentenced to 21 months in prison after he pleaded guilty in May to sending obscene material to a minor. At the time he was married to Hillary Clinton’s top aide, Huma Abedin.

Weiner, 53, will be required to register as a sex offender, and must report to prison by November 6.

The judge said that after his 21-month sentence is served, Weiner must undergo internet monitoring and have no contact with his victim. He must also enroll in a sex-offender treatment program.

Speaking before the judge on Monday, Weiner called his crime “rock bottom,” saying he was “a very sick man for a very long time.”

Anthony Weiner, sentenced to 21 mths in federal prison, quickly departs courthouse w/lawyer. Heckler references "Carlos Danger" pseudonym. pic.twitter.com/ueGfwh5bQU — Nicole Fuller (@nicolefuller) September 25, 2017

Weiner faced up to a decade in prison after a 15-year-old girl in North Carolina revealed last year that she and Weiner exchanged explicit messages for months, and that at one point he asked her to film herself undressing.

Weiner’s lawyers argued that the former congressman acted out of the “depths of an uncontrolled sickness” and was now being treated, and asked that he be sentenced to probation rather than jail.

On Monday, Weiner cried as his sentence was announced by US District Judge Denise Cote in Manhattan, New York.

Courtroom sketch artist depicts a weeping Anthony Weiner reading statement and holding tissue. pic.twitter.com/ps2CZBg6Pc — Nicole Fuller (@nicolefuller) September 25, 2017

Weiner resigned as a congressman in 2011, after it was revealed that he had exchanged explicit messages with multiple adult women, while married to Abedin. Two years later, he dropped out of the New York mayoral race, when it emerged that he had continued sending lewd messages to other women.

Read more

The former congressman married Abedin in 2010 in a ceremony officiated by former President Bill Clinton. Abedin served as a top aide for Hillary Clinton through her time as US secretary of state and later through Clinton’s 2016 presidential run.

“What I want to say is I love him, I have forgiven him, I believe in him, and as I have said from the beginning, we are moving forward,” Abedin said in 2013 after the series of sexting scandals.

However, two years later she announced she was leaving him, after the New York Post published a story about more explicit texts the politician sent that year, with one photo showing Weiner in his boxer briefs while in bed with his toddler son by his side.

A year later, the FBI and New York Police Department launched an investigation into Weiner after a 15-year-old girl told the Daily Mail the former politician had sent her lewd messages.

The investigation into Weiner’s exchanges with a North Carolina high school student led to the discovery of Abedin’s emails with Hillary Clinton when she was secretary of state, on Weiner’s laptop. This prompted the former head of the FBI, James Comey, to announce that the agency was reopening its investigation into Clinton’s use of a private email server.

READ MORE: FBI director: I have 'never' been anonymous source on Clinton, Trump investigations

Clinton later said Comey’s announcement in the final days of the 2016 presidential race contributed to her loss to Donald Trump.