Paul Reilly, 32, and Michael Martin, 34, had no idea the drone’s camera was recording footage of them as they prepared to fly nearly £3000 worth of drugs into Perth Prison.

Footage played in court clearly showed the faces of the duo - along with a mystery third man - as they hid drugs inside Kinder Eggs.

The gang also managed to film the door number of the house they were operating from and a car parked outside which belonged to them.

Sign up to our daily newsletter The i newsletter cut through the noise Sign up Thanks for signing up! Sorry, there seem to be some issues. Please try again later. Submitting...

Paul Reilly was caught on footage from the drone's camera s.

The footage was recovered by prison officers when the drone, with the drugs still attached to it, crashed and was found lying inside the prison yard.

The film was analysed and Reilly and Martin were quickly identified from the footage by police officers.

At Perth Sheriff Court on Tuesday, Reilly, from Cumbernauld, admitted being concerned in the supply of drugs on 22 September 2017.

He admitted supplying cannabis, cannabis resin, buprenorphine and etizolam from East March Street, Kirkcaldy.

Michael Martin had been trying to get the drugs to his prisoner brother .

Fiscal depute John Malpass told the court: “Paul Reilly was identified from CCTV footage on February 15.

“He has previous convictions for disorder, violence and drugs offences and has served time in prison.”

Reilly also admitted failing to turn up for a previous court hearing and Sheriff Lindsay Foulis jailed him for a total of 33 months.

The drugs were hidden inside Kinder Egg sweets.

Sheriff Foulis said: “The observation I would make is that as the packaging of the drugs involved a drone it was perhaps obvious to anyone with a knowledge of drugs practice that this supply operation was certainly not run of the mill.

“This is your third conviction for being concerned in the supply of drugs and account has to be taken of that.”

While Reilly was being hunted by police in May this year, Martin, from Kirkcaldy, went on trial and was found guilty by a jury of supplying drugs into Perth Prison. He was jailed for a year.

Martin accidentally recorded over 18 minutes footage of the gang preparing the drone with a drugs package.

In that case, fiscal depute Michael Sweeney said: “If there was an award for the movie with the most inept director, then it would have been won by the accused.”

The jury was told that a second drone flight led to a package being hooked with a makeshift fishing rod into Chris Martin’s cell on the prison’s third floor.

Mr Sweeney said: “The message seems to be that if at first you don’t succeed, then fly, fly again.”

Martin, Cedar Avenue, Kirkcaldy, was found guilty of being concerned in the supply of drugs at Perth Prison on 22 September last year.

He was cleared of a number of other charges including breaching civil aviation laws by flying a drone into a prison on both 22 and then again on 25 September.

PC Nicholas Schembri, 38, told the trial the drone video showed a tour of the inside of Martin’s girlfriend’s property.

He noted that the faces of all three men were visible on screen and that Martin could be recognised from a tattoo he has on his neck.

A wooden decoration - spelling out his girlfriend’s name Teri - was also seen in the video and a car could be seen when the drone was eventually taken outside.

PC Schembri said: “I don’t think they were aware the drone was actually filming at that time. I’m assuming he was looking at the drone to check if it was on, if it was functioning.

“He was maybe making sure it was properly set-up. From the footage I viewed you could see clearly a tattoo on his neck.”

The officer told the jury that one of the other men was seen packing a Kinder egg with items and was wearing socks over his hands as he sealed the package.