A Dundee shoplifter set out to be caught by police as part of a plan to make money selling drugs to inmates at Perth Prison.
Gary Gibson smuggled cocaine into the jail inside two plastic Kinder Egg shells, after being arrested for shoplifting.
The 25-year-old hoped to make money by passing on the class A substance to fellow inmates.
Gibson appeared from custody at Perth Sheriff Court and admitted being in possession of cocaine, with intent to supply, on November 13 2013.
Fiscal Gavin Letford said Gibson had recently arrived at HMP Perth and was moved to a cell in B-Hall.
He said a prison officer looked into Gibson’s room and saw he was partially undressed and “acting suspiciously” beside the cell’s toilet.
“He appeared to be concealing something underneath a towel,” Mr Letford said.
The cell was searched and two plastic Kinder Eggs were found on the floor.
Mr Letford said they contained just under 10g of cocaine, with a street value of £2,500.
The court heard Gibson, whose address was listed on court papers as Thurso Crescent, has a lengthy record for minor offending and his dependency on drugs had worsened in recent years.
He had started using heroin and diazepam and was shoplifting to fund his habit.
Sheriff William Wood told him: “The nature and frequency of your offending seems to be escalating. This has led to a revolving door of custody.”
He added: “I am afraid if you keep on offending that is going to be your life. It’s not much of a way to live.
“It is a serious offence because it is a significant amount of class A drugs in a secure prison setting. It is a significant aggravating factor that it took place in a prison.”
Sheriff Wood sentenced Gibson to 18 months’ imprisonment.
Last year Perth Prison bosses said a crackdown on drug smuggling behind bars was proving successful, with new technology and dogs used to detect banned substances.