(NBC NEWS) Disgraced former Congressman Anthony Weiner pleaded guilty Friday in connection with a sexting scandal involving a teenage girl — and faces about two years in federal prison.

Weiner, 52, pleaded guilty in Federal District Court in lower Manhattan to transferring obscene material to a minor. Under a plea agreement, prosecutors asked he serve 21 to 27 months behind bars. The ex-politician must also register as a sex offender.

He was released on bail pending a Sept. 8 sentencing, when a judge could decide instead to give him probation. He was required to surrender his passport and iPhone, and has agreed not to leave New York before the sentencing, according to NBC New York.

Note: Read our discussion guidelines before commenting.