A judge said Berwyn prison's status as a flagship jail for prisoner rehab was being undermined by drug-taking inside its walls.

Judge Niclas Parry said things appeared to be "going awry" at the super-jail as he sentenced an inmate for arranging to take £7,500 of drugs into the prison.

The court heard the tablets had been smuggled in by David Hunt and another man, who hid them up their backsides.

Judge Parry told Hunt that he would be sentenced on the basis that he accepted his claim the drugs were for his own personal use.

But he said in a confined space like a prison they could have fallen into the wrong hands and added to the misery of others struggling with addictions.

Hunt, 42 of Newport in South Wales, received a consecutive eight month to the sentence he is already serving.

A prison guard walks through a cell area at HMP Berwyn

Judge Parry said: "Drugs in prison undermine everything that prison is about.

“Sadly this occurred at a flagship prison where rehabilitation was the vision.

“It appears that things may be going awry and drugs are the reason for that.”

Prosecuting barrister Paulinus Barnes said that a visitor and Hunt were caught with 150 class C tablets worth £7,500 hidden up their bottoms on New Year's Eve.

The visitor, Phillip Jones, had driven from South Wales on December 31, 2017, but officers were monitoring what they were up to and caught each of them with 75 tablets of Buprenorphine.

Intelligence had been received about drugs being taken into prison and the two men were watched.

”At one point Jones moved his legs apart and something dropped on the floor which he retrieved."

Officers moved in and searched the two men, and Mr Barnes said Hunt who had been seen with his hands down his trousers was found to have a packet up his backside.

There was DNA which matched both his and Jones, who was also strip searched at the police station and found to have the same amount of drugs.

The HMP Berwyn inmate who broke a guard's nose when he refused to get back into his cell

Investigations showed that there had been telephone contact between the two in the days leading up to their arrest.

Estimates put the value of the tablets at about £50 each, said Mr Barnes, who highlighted the difficulties drugs caused in prison.

He said that undermined the ultimate aim of rehabilitation and caused difficulties when prisoners got into debt with each other with bullying and the creation of a gang culture.

It was the prosecution case that whatever the defendant’s basis of plea the fact was that whether they were kept in his cell or on his person, there was a risk that some could be taken by others.

Duncan Bould said that Hunt had previously been addicted to class A drugs.

The class C drugs were to be used to help wean himself off hard drugs while he was serving an extended sentence.

He was not due to be released until 2021 and it was against that background that the arrangement was made.

It was a bid to “take control of his own circumstances” but he accepted that whatever his own intentions there was a potential that they would find their way into the wrong hands.

Jones, 50, of Chepstow Road, Cwmparc, Treorchy, previously pleaded guilty to two counts of possession with intent to supply and supplying drugs and was jailed for 10 months.

Buprenorphine - also called Subutex - is a mixed opiate used to treat opioid addiction and chronic pain.