Anthony Weiner wrapped up the last leg of his prison sentence for sexting an underage girl on Tuesday morning, walking out of a Bronx halfway house a free man.

“It’s good to be out,” the disgraced former congressman said. “I hope to be able to live a life of integrity and service. I’m glad this chapter of my life is behind me.”

Weiner, who will still be registered as a Level 1 sex offender, had called the halfway house on Creston Avenue home for three months following his transfer from a Massachusetts lockup as part of a federal re-entry program.

He walked out shortly after 6 a.m. wearing khaki pants, red Nike running shoes and a sweater. His release came early after getting three months shaved off for good behavior.

The Post revealed last month how he is now hoping to land a book deal.

After sinking his political career in a series of salacious sexting scandals with adult women, the married ex-pol was busted in 2017 for sending obscene messages to a 15-year-old North Carolina high schooler.

Weiner wept and called himself a “very sick man” at his sentencing, where he was ordered to serve 21 months behind bars, pay a $10,000 fine and to register as a sex offender upon his release.

He started his time in November 2017 in the Federal Medical Center in Devens, Mass., a former Army base about 40 miles northwest of Boston and just one of two sites that offer residential treatment for sex offenders.

He was transferred in mid-February to the Bronx — where The Post caught him ordering a hearty pasta take-out.