Former congressman Anthony Weiner was sentenced to 21 months in prison for sexting with a 15-year-old girl.

Weiner, 53, who had pleaded guilty in May to one charge of transferring obscene material to a minor, wept as the sentence was handed down Monday in a Manhattan federal court. He must also register as a sex offender for life for his inappropriate conversations with the North Carolina teen. The once-rising star in the Democratic Party had faced up to 10 years in prison.

“Weiner, a grown man, a father, and a former lawmaker, willfully and knowingly asked a 15-year-old girl to display her body and engage in sexually explicit conduct for him online,” prosecutors wrote. “Such conduct warrants a meaningful sentence of incarceration.”

Last fall, then-FBI Director James Comey cited emails involved in the Weiner case to reopen an investigation into Hillary Clinton’s private server less than two weeks before the presidential election. The FBI shut down the investigation days later, saying that nothing new or damaging had come to light, but Clinton has blamed the new probe in part for her loss to Donald Trump.

Weiner’s troubles date back to 2011, when the Jewish lawmaker resigned from Congress after tweeting an explicit photo. He has since been involved in multiple sexting scandals, and his wife, Huma Abedin, a longtime Clinton aide, is in the process of divorcing him.

The girl involved in this case, whose name has not been officially released, has said that she initiated the contact with Weiner for political reasons. She sold her story multiple times, including to the British Daily Mail tabloid for $30,000.