Smith was freed on $50,000 bond and appeared in court as scheduled for nearly a dozen conferences and hearings over the next six months. He pleaded guilty before Justice Christopher Jr. Burns on Aug. 17 to two charges of selling opioids, and, because of his diligence in following the bail requirements, the judge allowed bail to continue until Smith’s sentencing, set for November.

In accepting that plea, Burns also had agreed that Smith would receive no more than nine years in prison for the crimes, providing he stay out of trouble and remain arrest free.

Smith broke that agreement on Oct. 7, when police holding a search warrant went to Arkansas Street home where he was staying and found more than an eighth of an ounce of heroin. So, in November, instead of being sentenced for the first drug arrest, Smith was pleading guilty before Burns again, this time to criminal possession of a controlled substance.

On Thursday, Burns remarked to Smith that he should have gotten a real job instead.

The judge also said that, although Smith’s crimes are considered nonviolent felonies, he was in truth “peddling death.”

Smith has not been identified as the supplier of drugs known to have caused any of the overdose deaths, but fentanyl, which is more powerful than heroin, generally is associated with many of the drug deaths being counted in the national opioid epidemic. Erie County’s Department of Health reports at least 230 opioid deaths so far in 2016, with 94 more suspected.

No longer bound by his original sentencing agreement, Burns sentenced Smith to 13 years in prison for his original conviction plus three years post-release supervision, and eight years for the drug possession conviction. The sentences will run concurrently.

Assistant District Attorney Paul J. Williams III, who prosecuted the case, said he had spoken with Debra Smith, a woman whose son died of an overdose in 2015 and who had asked that Robert Smith be denied bail after his second arrest.