A prison officer smuggled cannabis and mobile phones into the jail where he worked.

John Wallace, nicknamed Waldo, of Craigmore Crescent, Nethy Bridge was paid £1800 to deliver the illegal contraband over a five-month period to help pay off mounting family debts.

He would place the drugs and phones into socks, then into cardboard boxes labelled "Beat the Bosses Mobile Phone" and throw them over the prison wall.

Wallace picked them up on the other side when he was on duty.

Sheriff Gordon Fleetwood told him: "This was a gross breach of trust and both those in prison and your employers should have been able to rely on your integrity.

"But I will take into account the difficulties you will face in prison. I consider five years as appropriate but I will reduce this by a third to one of three years and four months to take into account your early plea."

The sentence was backdated to February 10.

Wallace's solicitor advocate Urfan Dar said his client was spending 23 hours a day in virtual solitary confinement because of his previous employment.

He told the sheriff his client knew to expect a lengthy jail sentence but that there were only five deliveries for which he was paid a total of £1800.

Mr Dar added some deliveries were not made because his client was "frightened".

He added: "The method of delivery was pretty rudimentary - throwing a sock over the wall gives an indication of how reckless it was.

"His motivation was pressure of debt and this denotes an element of pre-planning. There were secrets in his relationship, which is under considerable strain, and his wife was not aware of his activities."

Wallace was employed by the Scottish Prison Service for around 10 years and worked at HMP Inverness, also known as Porterfield Prison.

The court was told that despite his £28,000 a year salary, he and his wife had mounting debts.

Police were tipped off about the smuggling and Wallace's illicit activities were halted on March 18, 2016 when he was arrested.

The court was told that officers pounced when Wallace was in the Tesco Car Park at Inshes, Inverness.

He immediately told them: "There's drugs in the car... they're in a red bag in the boot of the car."

The court heard a Charlene Calvert was a partner of another inmate at the prison, Andrew Cairns, and she had been a go-between.

Wallace would collect the parcels from her and hand them over to Cairns inside the prison between October 27, 2015 and March 17, 2016.

She told police: "Wallace never said no to taking in packages, he was always willing and even initiated the requests as he was desperate for money."

She added he would take the packages into the prison when he was not on duty.

When interviewed by the police, Wallace told officers had taken cannabis and mobile phones in to the prison for inmates "a couple of times" and this was a result of his personal financial problems.

He added: "I was desperate, I didn't know what else to do and am guilty. I am now going to lose everything and I know that.

"I have had a lot of time to think this morning in the cell and I know its coming. No one to blame but myself."