Ex-New York congressman Anthony Weiner burst into tears as he was sentenced to 21 months' jail for sending sexually explicit messages to an underage girl.
He pleaded guilty in May to transferring obscene material to a minor and agreed not to appeal against a prison sentence of 27 months or less.
Weiner, 53, quit Congress in 2011 over sending explicit messages and was again exposed in his 2013 run for New York mayor.
His lawyers had asked a US District Judge for probation instead of jail.
But in sentencing Weiner, US District Judge Denise Cote said: "This is a serious crime that deserves serious punishment."
She also said Weiner "has a disease. He has a compulsivity. Some say a sex addiction."
Acting Manhattan US Attorney Joon H Kim said in a statement that Weiner "asked a girl who he knew to be 15 years old to display her naked body and engage in sexually explicit behaviour for him online".
"Justice demands that this type of conduct be prosecuted and punished with time in prison."
In addition to jail time, Weiner was sentenced to three years of supervised release, according to a statement from the US Attorney's Office.
Weiner's lawyers contended the former politician had acted out of the "depths of an uncontrolled sickness" and was now seeking treatment.
In a letter to Judge Cote, Weiner said he felt "profound" regret for his crimes and that his misconduct had "crushed the aspirations" of his wife, Huma Abedin, and ruined their marriage.
Ms Abedin filed for divorce on the same day as her husband was found guilty in May.
She did not attend the sentencing, but asked for leniency on their son's behalf in a letter to the judge.
The FBI began investigating Weiner last September after the Daily Mail reported that he had exchanged obscene messages with a North Carolina teenager.
The 15-year-old girl said he had asked her to undress on camera.
A month earlier, Ms Abedin announced she was separating from her husband after it emerged he sent a photo of himself in his underpants with his toddler son nearby.
The New York Post reported that Weiner had sent sexual messages along with the photo to an unidentified woman in 2015.
Once a rising Democratic star, he stepped down from Congress in June 2011 after a graphic image sent from his Twitter account went public.
Initially claiming his account was hacked, he eventually confessed to having lied.
Weiner also admitted indulging in explicit online exchanges with at least six other women and pledged to seek therapy.
He tried to revive his political career in 2013 by running for mayor of New York.
But his campaign imploded amid reports of further graphic online messages.
The investigation into Weiner's sexting case played a role in last year's 2016 presidential election, when authorities found emails on his laptop from Ms Abedin, who was a senior aide to Democratic presidential candidate Hillary Clinton.
A separate FBI investigation into Mrs Clinton's private use of email while she was secretary of state was closed after officials said nothing incriminating was found.