Anthony Weiner pleads guilty in sexting case and must register as sex offender; Huma Abedin files for divorce He turned himself into the FBI this morning.

 -- Anthony Weiner, the disgraced former New York congressman and estranged husband of top Hillary Clinton aide Huma Abedin, tearfully admitted today to a federal judge that he sent obscene material to a 15-year-old high school student in North Carolina, the same day Abedin filed for divorce from him.

Weiner, who turned himself into the FBI, pleaded guilty in federal court this morning to a single count of transferring obscene material to a minor. This afternoon a court official confirmed that Abedin filed for divorce after seven years of marriage. The divorce is uncontested.

Weiner agreed to surrender his iPhone as part of the plea agreement and he must register as a sex offender.

In an emotional statement today, Weiner said he "compulsively sought attention from women," engaging many of them in sexual and non-sexual conversations. He said his behavior started when he entered Congress and it continued through the first six months of 2016.

"These destructive impulses brought great devastation to my family and friends, and destroyed my life's dream of public service," he said.

Weiner admitted to sharing explicit images with the 15-year-old and encouraging her to engage in sexually explicit conduct; he said he knew his behavior was "as morally wrong as it was unlawful."

Weiner said last fall is when he "came to grips for the first time with the depths of my sickness" and entered "intensive treatment."

"I have a sickness," Weiner said, "but I do not have an excuse."

Weiner also apologized to the teenage girl.

Weiner agreed to serve 21 to 27 months in prison but he will be released on $150,000 bond. His sentencing is scheduled for Sept. 8.

Weiner's attorney, Arlo Devlin-Brown, said in a statement that the former politician "accepted full responsibility for the inappropriate, sexually explicit communications he engaged in early last year. He apologized, offered no excuses, and made a commitment to make amends."

"As reflected in the plea agreement, the resolution on terms far less severe than could have been sought reflect 'the specific circumstances of the offense conduct in this case,' which did not feature aggravating factors often present in cases of this kind," Devlin-Brown said. "Mr. Weiner will not be addressing this matter beyond his statement this morning in Court, and remains focused on his recovery.”

The emails that prompted the FBI to reopen its review of Clinton’s private email server days before the 2016 presidential election emerged from the 2016 federal investigation into whether Weiner sent explicit messages to to that underage girl in North Carolina.

During that federal investigation, at least one device used by Weiner and Abedin was discovered. Abedin was among a tight-knit group that had an email address on Clinton’s private server.

Abedin announced her separation from Weiner in August 2016. The two married in 2010, and in June 2011 Weiner resigned from Congress, a month after the release of an explicit photo of him that he inadvertently posted on his Twitter account. At the time, Abedin was pregnant their son, who was born in December 2011. Weiner ran for mayor of New York City in 2013 during which a similar sexting scandal unfolded.

ABC News' Emily Stanitz contributed to this report.