NEW YORK (CBSNewYork/AP) – Disgraced former Congressman Anthony Weiner was released from federal custody Tuesday after completing a nearly two-year sentence for having illicit online contact with a 15-year-old girl.

“I am glad to be getting back to my family. I hope to be able to live a life of integrity and service,” he told reporters outside a halfway house in the Bronx. “Hopefully this chapter of my life is behind me.”

READ MORE: 16-Year-Old Isaiah Levine Killed In Double Shooting On Lower East Side, Second Victim In Hospital

Weiner, 54, was ordered in April to register as a sex offender as he neared the end of a 21-month prison sentence.

The judge designated him a Level 1 offender under the state’s version of what’s known as Megan’s Law, meaning that he is thought to have a low risk of reoffending.

WEB EXTRARead Weiner’s complete sentencing remarks (.pdf)

The a once-rising star in the Democratic Party who served in Congress for nearly 12 years had been living in a halfway house since February after serving most of his sentence at a prison in Massachusetts. He still faces three years of court supervision.

He pleaded guilty in May 2017 to transferring obscene material to a minor.

Prosecutors said Weiner had a series of sexually explicit Skype and Snapchat exchanges with a North Carolina high school student and encouraged the teen to strip naked and touch herself sexually.

At his sentencing, he said he’d been a “very sick man for a very long time” and said he had a sex addiction.

MORE: Huma Abedin, Anthony Weiner To Settle Divorce Privately

READ MORE: Robert Durst Hospitalized With COVID-19, His Lawyer Says

Weiner’s lawyer said the former lawmaker likely exchanged thousands of messages with hundreds of women over the years and was communicating with up to 19 women when he encountered the teenager.

It wasn’t the first time Weiner had been caught acting inappropriately.

After sending a lewd picture of himself to a college student in 2011, Weiner claimed his account had been hacked, then admitted online interactions with at least six other women while married to top Hillary Clinton aide Huma Abedin.

Weiner resigned from Congress, only to try for a political comeback with a run for New York City mayor in 2013. Then came the revelation that Weiner had used the alias “Carlos Danger” to send explicit photos to at least one woman after resigning from Congress.

Weiner received less than 5% of the Democratic primary vote.

Abedin filed for divorce from Weiner in 2017. But the two, who have a young son together, later agreed to discontinue the case in order to negotiate their separation privately.

The investigation into Weiner’s contact with the 15-year-old roiled the 2016 presidential campaign because emails Clinton had sent to Abedin were found on a laptop computer FBI agents seized from him. That led then-FBI Director James Comey to announce just days before the election that that agency was reopening its investigation into Clinton’s use of a private email server while secretary of state.

Days later, Comey said nothing in the new emails changed his view that Clinton could not be charged with a crime.

Nevertheless, Clinton felt damage was done and said Comey shared blame for her loss to Donald Trump.

MORE NEWS: Queens Residents Want Local Bar Shut Down, Saying Patrons Urinate On Their Property, Leave Mess On Streets

(© Copyright 2019 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)