NEW YORK — Joey Merlino is headed back to prison.

"Skinny Joey," the onetime boss of the Philadelphia mob, was sentenced Wednesday to two years in federal prison for a gambling-related count to which he pleaded guilty in April.

The sentence, imposed by a federal judge in Manhattan, marks just the latest stint of incarceration for a mouthy celebrity gangster who has survived assassination attempts, beaten murder charges in court, and spent at least a decade locked up for prior convictions on counts of racketeering, conspiracy, assault, or related offenses.

It was the stiffest possible penalty for Merlino, who had opted to plead guilty to a single count instead of facing a retrial on a litany of other charges. And even as U.S. District Judge Richard Sullivan said he did not believe that Merlino was still the boss of La Cosa Nostra in Philadelphia, he insisted that Merlino needed to move on from his apparent penchant for criminal conduct.

"Mr. Merlino, enough," Sullivan said. "Let's move on."

Merlino, for his part, said afterward that he planned to use the time behind bars to get into shape. And, in an apparent reference to witnesses who cooperated with the government against him, he quipped: "President Trump is right — they've got to outlaw the flippers."

Sullivan allowed Merlino 45 days to self-surrender to a federal prison that would be determined at a later date.

Merlino, 56, has long insisted that he has left his criminal past behind — relocating to Boca Raton, Fla., in 2011 and serving as maître d' at an eponymous restaurant he opened there. But his most recent brush with the law resulted from his indictment in 2016 in a sweeping East Coast mob crackdown.

Manhattan-based prosecutors accused Merlino and 45 other alleged mobsters of operating illegal gambling rings and bribing doctors to write unnecessary prescriptions for topical skin creams, among other alleged schemes.

Nearly every defendant pleaded guilty before trial, but Merlino opted to take his case before a jury — even though he faced a lengthy potential prison term if convicted. Earlier this year, Sullivan declared a mistrial after jurors reported being hopelessly deadlocked.

Just two months later, in a surprising twist, Merlino decided to plead guilty to a single gambling count instead of facing a retrial. It was the first time the brash mobster had admitted to criminal conduct in court.

Edwin J. Jacobs Jr., Merlino's lawyer, said in April that the plea was prudent because Merlino — a longtime gambling addict — would be exposed to a much longer prison sentence if convicted at a retrial.

Still, after court Wednesday, Jacobs said he felt the sentence was too harsh. Guidelines suggested a penalty of 10 to 16 months behind bars, and Jacobs had argued in court documents for a sentence that included at least a component of house arrest.

He also requested that any prison sentence be reduced by four months to account for the time Merlino spent behind bars in 2014, when a federal judge in Philadelphia ordered Merlino jailed for violating his probation by socializing with a purported mob associate at a Boca Raton cigar bar. An appellate court eventually overturned that ruling, freeing Merlino just 10 days before his jail term was to have ended.

Prosecutors, meanwhile, had asked Sullivan to impose the full two-year prison term against Merlino, citing his extensive criminal history and what they viewed as a continuing indifference to obeying the law. In sentencing memos, they wrote that "the experience of standing trial twice for murder did not sufficiently discourage him from engaging in illegal activity."

Sullivan ultimately said he felt two years of incarceration was a good deal for Merlino, given the evidence presented at trial and the likelihood that his criminal conduct extended well beyond the single count to which he agreed to plead guilty.

The judge implored Merlino to learn from this case and to turn a corner in his life upon his release.

"You can't go back to this," he said. "You can't go back to this life, or even a shadow of this life."