NEW YORK CITY (WDRB) -- Former U.S. Rep. Anthony Weiner cried in court as he apologized to the 15-year-old girl with whom he exchanged sexually explicit texts.

Weiner appeared in a federal court room in Manhattan on Friday, as a judge accepted a 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.

The Democratic former congressman apologized to the 15-year-old, saying, "I have a sickness, but I do not have an excuse."

The judge told him he would have to register as a sex offender.

The FBI began investigating Weiner in September after the 15-year-old North Carolina girl told a tabloid news site that she and Weiner 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, Weiner's wife.

Copyright 2017 WDRB News. All Rights Reserved.