NEW YORK — For the first time, Joey Merlino admitted in court that he was guilty.

During an hour-long hearing Friday morning in federal court in Manhattan, the reputed boss of the Philadelphia mob pleaded guilty to one gambling-related count, all but ensuring himself another stint behind bars.

The decision by the celebrity mobster was notable in part because he had developed a decades-long habit of sparring with federal prosecutors, never admitting to criminal conduct, and seeming to relish the attention generated by his high-profile legal travails.

But the plea was also unusual because Merlino — known as "Skinny Joey" — had scored something of a victory in this case just two months ago, when a judge declared a mistrial after jurors weighing gambling, loan-sharking, and health-care fraud charges against him said they were "hopelessly deadlocked" during deliberations.

Leaving the courthouse in a natty blue suit and sunglasses as light rain fell, Merlino declined to comment about his plea. Instead, while peppered with questions from reporters, he said he thinks the 76ers will win the NBA championship.

Merlino's longtime lawyer, Edwin J. Jacobs Jr., said the plea to a gambling count was the "prudent" thing to do. Merlino, he said, "has been gambling his whole life," and the count to which he pleaded carries a two-year maximum sentence. It also ensured that prosecutors would drop the remaining counts against him, eliminating the risk of stiffer penalties if convicted.

Merlino will be sentenced in September. According to his plea agreement, prosecutors will recommend 10 to 16 months behind bars, although a judge will make the final decision.

Merlino, 56, earned notoriety in the 1990s while purportedly leading a faction of Philadelphia's Mafia during a long-running and violent power struggle. As a result, Merlino — who rose to fame as a rail-thin, slick-haired loudmouth — has been in prosecutors' crosshairs for most of his adult life.

In 2001, he was convicted on racketeering, gambling, assault, and weapons charges, earning him a decade in federal prison. Upon his release he moved to Florida and insisted he'd retired, but FBI agents often tailed him even as he opened an eponymous Italian restaurant and served as maître d'.

Merlino was imprisoned again in 2014 when federal agents spotted him cavorting with a purported mob associate at a Boca Raton cigar bar. A judge ruled that the encounter violated the terms of his probation and ordered him jailed. After four months, he was released when an appeals court overturned the ruling.

The latest case to ensnare Merlino was unveiled in 2016, when federal prosecutors in New York charged him and 45 other alleged mobsters with running illegal gambling operations, committing credit card fraud, and bribing doctors to prescribe unnecessary "prescription compound cream" to patients, among other misdeeds.

Nearly every other purported gangster facing charges — many of whom had alleged ties to New York-based crime families — opted to plead guilty. But Merlino took his case to trial in January, despite the prospect of facing decades behind bars. He also reportedly turned down a plea deal last summer, deciding to roll the dice in court.

After a three-week trial, the judge declared a mistrial when jurors said they could not agree on a verdict. Merlino at the time said simply: "Thank God for the jury."

This time, the jury box was empty. And in formally entering his plea, Merlino said a word he had never used to describe himself to a judge: "Guilty."