A serial offender moved 80 miles to a Lanarkshire rehabilitation unit only to get into trouble again.
Barry Davies, 41, was caught after breaking into a shop and stealing perfume.
Davies, of Dundee, was jailed for 14 months at Hamilton Sheriff Court this week.
He admitted breaking into B&M in East Kilbride on September 2.
His lawyer, James Caird, said Davies has drugs and mental health issues and had enrolled at a rehabilitation centre in Blantyre.
Mr Caird told the court: "That's what brought him to this area. He was desperate to do something about his drug problem.
"Unfortunately, funding was for only 12 weeks and no more was forthcoming.
"Eventually he moved to a hostel - Lindsay House in East Kilbride - where, he indicates, drugs were freely available.
"He was under the influence of drugs at the time of this break-in.
"He has a record, particularly for dishonesty - there is no getting away from that."
Mr Caird said Davies intends to return to Dundee on his release from prison.
Alice Carey, prosecuting, said a night shift worker heard glass breaking at 3am.
Ms Carey stated: "A pane of glass had been smashed and a brick was lying at the side.
"Perfume was missing from cabinets in the store.
"Police were called and identified the accused from the store's CCTV. He was stopped at 4am, carrying a bag that contained perfume worth £141.92."
Passing sentence, Sheriff Linda Nicolson told Davies: "You have a significant record, including for housebreaking.
"I would have jailed you for 21 months but for your guilty plea."
The 14-month prison stretch was backdated to September 5 as Davies has been in custody since his arrest.
Don't miss the latest headlines from around Lanarkshire. Sign up to our newsletters here.
And did yo u know Lanarkshire Live is on Facebook? Head over to our page to give us a like and share.