Two men involved in a £850,000 cannabis factory tried to make a getaway when they turned up to find police at the scene.
Troy Stirling, 30, and Ryan Paterson, 31, were part of the sophisticated set-up at a disused farmhouse in Moscow, East Ayrshire.
The crime took place behind a number of gates which lead up to the property.
Prosecutor Marco Guarino told the High Court in Glasgow how the drug operation had been set up in three different areas.
The house itself at Muirside Farm, a shed as well as in a cellar.
Police swooped on December 13, 2019 after being alerted to what was going on.
Mr Guarino: "Officers...detected a smell of cannabis and the whirring of fans."
He said police eventually seized a total of more than 1,400 cannabis plants with a potential total value of £849,000.
While officers were there, a car rolled up at the site.
Mr Guarino: "The vehicle reached where the police had parked...reversed and then made off at speed."
The motor was immediately followed and soon stopped. Stirling was driving with Paterson the passenger.
The pair, both of Ruchazie, Glasgow, pleaded guilty to being concerned in the supply of and producing cannabis between July 1, 2018 and December 13, 2019.
Lawyers Graeme Brown and David Fisken asked for Stirling and Paterson to remain on bail pending sentencing.
Lord Scott agreed and adjourned the case until next month.
Don't miss the latest Ayrshire headlines – sign up to our free daily newsletter here