A 52-year-old man narrowly escaped being locked up himself, after he accidentally took cannabis with him on a visit to a South Yorkshire prison, a court heard.
Prosecuting, Carl Fitch, told Sheffield Crown Court how John Wilcock took a small amount of cannabis into HMP Lindholme in Doncaster on June 11 last year when he went to the prison to visit his son.
Wilcock only realised he had a 'cannabis cigarette' in his pocket when he entered the prison's visitor centre, Mr Fitch told the court.
He added: "There are lockers where you can leave any property you don't want to take into the prison.
"The defendant said he didn't want to do that because he knew there were cameras there and went on to the prison search facility. There was an officer with a drugs dog. That dog started to become involved with the defendant and he was asked whether he had something with him."
Wilcock admitted to possessing the Class B drug during police interview, the court heard.
Mr Fitch said the Crown Prosecution Service accepted Wilcock's suggestion that the cannabis in his possession was for personal use and that he had not brought it to the prison to give to his son or any other inmate.
Wilcock entered a guilty plea to the offence of conveying a prohibited article into prison, on this basis, at the beginning of Tuesday's hearing.
Ian Goldsack, defending, said: "He's done something monumentally stupid, and realised that too late.
"He's cooperated thereafter - entering a plea today, which as Your Honour knows, was indicated in the lower courts."
Judge Graham Reeds QC sentenced Wilcock, of Widnes, Cheshire to a six-month curfew, which will be in place between the hours of 8pm and 7am.
He said: "If there had been any suggestion of intending to supply to your son or another prisoner then you would have been facing prison yourself.
"This is a different set of circumstances. In my view, it is akin to the simple possession of drugs."