Doug Stanglin

USATODAY

Former Congressman Anthony Weiner, tearfully acknowledging a "sickness" and "destructive impulses," pleaded guilty Friday to federal charges of transmitting sexual material to a minor and could face a prison term.

His estranged wife, Huma Abedin, the one-time close aide to Hillary Clinton, filed for divorce the same day. The divorce action, labeled "anonymous versus anonymous," was filed in Manhattan Supreme Court, the Associated Press reported.

The 52-year-old Democratic politician from New York, who resigned from Congress in 2011 over an earlier sexting scandal, will also have to register as a sex offender.

Weiner appeared before a federal judge in a Manhattan and agreed not to appeal any sentence between 21 and 27 months in prison. He was released on bail pending a final sentencing hearing in September.

In court, Weiner cried as he apologized to the teenager with whom he exchanged sexually explicit texts.

"I accept full responsibility for my conduct," he said. "I have a sickness, but I do not have an excuse. I apologize to everyone I have hurt. I apologize to the teenage girl, whom I mistreated so badly. I am committed to making amends to all those I have harmed."

He told the court that this fall he "came to grips for the first time with the depths of my sickness."

"I had hit bottom," Weiner said. "I entered intensive treatment, found the courage to take a moral inventory of my defects, and began a program of recovery and mental health treatment that I continue to follow every day."

The former congressman told the judge that "these destructive impulses brought great devastation to family and friends, and destroyed my life’s dream of public service. And yet I remained in denial even as the world around me fell apart."

Acting Manhattan U.S. Attorney Joon H. Kim, speaking afterward to reporters, said Weiner's conduct "was not only reprehensible, but a federal crime, one for which he is now convicted and will be sentenced."

According to the charges, prosecutors said, Weiner used online messaging and video chat apps to communicate with a girl "he knew to be 15 years old."

Prosecutors said he "transferred obscene material to the minor victim, including directions to engage in sexual conduct and sexually explicit images."

The FBI began investigating Weiner in September after a 15-year-old North Carolina girl told DailyMail.com that she and Weiner exchanged lewd messages for several months. She also accused him of asking her to undress on camera.

The charge carries a potential sentence of up to 10 years in prison, but could involve no jail time depending on the determination of a judge.

The incident spilled over into the presidential race when investigators seized Weiner's laptop and found a cache of purportedly new emails that Democratic presidential candidate Hillary Clinton sent to Abedin. The emails had apparently been forwarded to the computer or transferred there for printing or storage.

The incident prompted then-FBI director James Comey to state publicly — in the final weeks of the presidential campaign — that the closed investigation into Clinton's alleged mishandling of classified material was being reopened. He later said the emails were duplicates of earlier material already examined by the FBI.

Weiner ran unsuccessfully for mayor of New York in 2013 in a campaign that collapsed when Weiner, using the alias "Carlos Danger," again was found to be sending explicit photographs. The failed mayoral bid is the subject of the documentary Weiner.

Contributing: Associated Press