Three months after he traded federal prison for a halfway house in the Bronx, the disgraced former congressman and failed New York City mayoral candidate -- who served a 21-month sentence for sexting with a minor -- has been released from prison custody.

"It's good to be out," Weiner told CNN on Tuesday morning.

What's next? "I hope to be able to live a life of integrity and service," he said. "I'm glad this chapter of my life is behind me."

Weiner's future is unwritten, but his legacy is set in stone. In the months before the 2016 election, the FBI executed a search warrant that accessed his laptop as part of the investigation that would eventually land him in jail. It turned up a trove of emails investigators believed could be relevant to an earlier probe -- believed closed -- into Hillary Clinton's handling of classified information while she was secretary of state. Then, on Oct. 28, 2016, former FBI director James Comey effectively reversed course, sending a letter to Congress stating that the "FBI has learned of the existence emails that appear to be pertinent to the investigation."

The October surprise kicked off a series of headlines that many Clinton supporters believe cost her enough support to deliver Donald Trump the presidency less than two weeks later.

Weiner has never spoken publicly about his role in the controversial episode. Nothing was turned up in the emails -- belonging to his wife, Clinton aide and confidant Huma Abedin -- pulled from his laptop. But Clinton believes the ensuing circus doomed her.

"It wasn't a perfect campaign. There is no such thing. But I was on the way to winning until a combination of Jim Comey's letter on October 28th and Russian WikiLeaks raised doubts in the minds of people who were inclined to vote for me but got scared off," Clinton told CNN's Christiane Amanpour months later. "And the evidence for that intervening event is, I think, compelling, persuasive."

FBI Deputy Director Andrew McCabe was reportedly informed about the potential for a renewal of the probe about a month before Comey delivered his letter.

"Got called up to Andy's earlier...hundreds of thousands of emails turned over by Weiner's atty to sdny, includes a ton of material from spouse," FBI counterintelligence agent Peter Strzok wrote to FBI lawyer Lisa Page in late September -- the "spouse" being Abedin. "Sending team up tomorrow to review ... this will never end ...,"

Weiner attorney Arlo Devlin-Brown declined to comment on his client's release when reached by CNN.

In 2017, Weiner pleaded guilty to one charge of transferring obscene material to a minor. He reported to prison on Nov. 6, 2017, just short of the one-year anniversary of Trump's shocking victory. In October 2018, Weiner was granted a release three months earlier than the initially scheduled date of August 2019, due to good behavior.

Weiner served about 15 months of his sentence at the Federal Medical Center in Devens, Massachusetts, before his transfer to the halfway house.

As part of his sentence, Weiner has been designated as a low-level sex offender. He must register for 20 years as a level one offender, the lowest level designation for sex offenders, per state regulations.

Weiner resigned from Congress in 2011 after admitting he engaged in inappropriate, extramarital relationships with several women he met online. He tried to resurrect his political career in 2013 with a run for mayor of New York City. But that bid flamed out spectacularly when it was revealed that Weiner had continued his sexting, even using the now infamous alias, "Carlos Danger."

Weiner stayed in the Democratic primary even as the scandal escalated. But his campaign was shot. He finished fifth with 4.9% of the vote. The winner, Bill de Blasio, is now in his second term as mayor and is expected to enter the 2020 Democratic presidential primary.