A homeless man who was using the painkiller Tramadol in a bid to kick his heroin problem has been sent back to prison for two weeks, a court heard.
Anthony Hill was arrested at the Queen's Buildings, in Worksop, on May 8.
Prosecutor Robert Carr said Hill told police he had been trying to withdraw from heroin.
He was last in court on March 13, and was recalled to prison for 14 days.
District judge Andrew Meachin said: "It's hardly something you send people to prison for."
David Grant, mitigating, said: "To some extent your hands are tied."
Hill, 32, of no fixed abode, admittted possession of the Class C drug, when he appeared at Mansfield Magistrates Court, on Thursday.
The judge told him: "It's a low-level offence, although you have a poor record."
Hill received a 12 month conditional discharge, and was ordered to pay a government surcharge of £20 and £85 court costs.