Former New York congressman Anthony Weiner has tearfully pleaded guilty to sending obscene material to a minor.
The charge stems from sexually charged text messages he exchanged with a 15-year-old girl last year.
Weiner, 52, stepped down from his congressional seat in 2011 over a sex scandal and was again exposed during his 2013 bid for New York mayor.
He must register as a sex offender and faces a possible prison term.
Weiner’s estranged wife Huma Abedin filed for divorce from him on Friday, according to New York media.
He entered his plea earlier in the day at a Manhattan court and was released on bail, pending sentencing on 8 September.
As part of his plea agreement, federal prosecutors said they would consider a term between 21-27 months “fair and appropriate”.
Weiner cried in court as he said: “I have a sickness, but I don’t have an excuse.”
He acknowledged it was “morally wrong” and unlawful to have knowingly sent obscene messages between January and March last year to a North Carolina girl whom he knew to be 15 years old.
Weiner paused to compose himself as he read from a letter he prepared for his plea.
“Beginning with my service in Congress and continuing into the first half of last year,” his statement said, “I have compulsively sought attention from women who contacted me on social media.
“These destructive impulses brought great devastation to my family and friends, and destroyed my life’s dream of public service.
“And yet I remained in denial as the world around me fell apart.”
He went on: “This fall, I came to grips for the first time with the depths of my sickness. I had hit bottom.”
Acting Manhattan US Attorney Joon H Kim praised the work of the FBI and the special victims’ division of the New York City Police Department.
“Weiner’s conduct was not only reprehensible, but a federal crime, one for which he is now convicted and will be sentenced,” Mr Kim said.
Weiner’s sexting scandal made headlines during last year’s US presidential election.
During an investigation, FBI officials found emails on Weiner’s laptop from his ex-wife, Ms Abedin, who was a top aide to Democratic candidate Hillary Clinton.
An 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.
The FBI began investigating Weiner last September after the Daily Mail reported that he had exchanged lewd messages with the North Carolina teenager.
The girl said he had asked her to undress on camera.
The girl’s father told the British newspaper after Friday’s plea deal was announced: “I don’t know if it’s justice.
“Just because he’s pleading guilty doesn’t mean he’s going to do a bit of time.”
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 alleged 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.
Ex-congressman Anthony Weiner pleads guilty to sexting case