A convicted drug courier has admitted having more than £17,000 worth of heroin hidden in his cell.
The drugs were found in McLaughlan's toilet at the prison
The High Court in Edinburgh heard how prison officers also found steroids, electronic scales, syringes and mobile phones in Ian McLaughlan's cell.
The drugs and paraphernalia were behind skirting boards in McLaughlan's toilet at Castle Huntly prison, Perthshire.
Judge Lord Menzies deferred the 42-year-old's sentence to the High Court in Dunfermline on 30 November.
McLaughlan pleaded guilty to being concerned in the supply of heroin between 20 June and 20 July.
The court heard how he had been jailed in February 2004 for seven years, after drugs were found in a car he was driving.
He was transferred to Castle Huntly, an open prison, and given a solitary cell with an adjoining toilet because he suffers from Crohn's Disease.
Advocate Depute Sean Murphy, QC, said that during a search on 20 July prison officers found 53g of heroin worth a top prison value of £17,600.
Defence agent David Moggach said the drugs belonged to other prisoners who stored them in McLaughlan's cell, adding that only the mobile phone had been his.
He said the men would visit the prisoner every day, use his toilet and leave again.
He said his client had allowed this to occur because he was afraid of the men and feared what would happen if he refused.
"One of the prisoners takes steroids and is very muscular," Mr Moggach said.
"These people entering his cell would have been picked up on CCTV footage."
Mr Moggach said McLaughlan had overcome his own drug habit and did not benefit from the arrangement.
Following the search, he was transferred to Kilmarnock Prison.
He has two previous convictions for being concerned in the supply of drugs and his earliest release date from his current sentence is July 2008.