Last Updated May 19, 2017 11:48 AM EDT
NEW YORK -- Former Congressman Anthony Weiner pleaded guilty to criminal charges on Friday in an investigation of his online communications with a teenage girl in North Carolina, CBS News has confirmed.
The judge accepted Weiner's guilty plea to a charge of transmitting sexual material to a minor. He agreed to not appeal any sentence between 21 and 27 months in prison.
During the hearing, the Democratic former congressman apologized through tears to the 15-year-old girl with whom he exchanged sexually explicit texts, saying, "I accept full responsibility for my conduct. I have a sickness, but I do not have an excuse. I knew this was as morally wrong as it was unlawful."
"These destructive impulses brought great devastation to my family and friends, and destroyed my life's dream of public service," he continued. "I am committed to making amends to all those I have harmed."
Weiner was already in federal custody ahead of the hearing. The judge said he will have to register as a sex offender.
Theafter a North Carolina teenager told a tabloid news site that she and the disgraced former politician had exchanged lewd messages for several months. She also accused him of asking her to undress on camera.
The investigation of his laptop led to the discovery of a cache of emails from Democratic presidential nominee Hillary Clinton to her aide Huma Abedin,.
State law makes it a felony to knowingly send minors "harmful" online messages or pictures involving nudity or sexual conduct or ask them to engage in sexual acts or performances. Some federal criminal laws also prohibit such behavior.
The disgraced former congressman acknowledged he communicated online with a girl who accused him of sending sexually explicit messages, but said he's also been the.
Weiner unsuccesfully ran for mayor in 2005. He led the polls during his second mayoral bid in 2013 until it was revealed he had continued his questionable behavior after his resignation from Congress in 2011.
His lawyer, Arlo Devlin Brown, didn't immediately return a message for comment on Friday.