A mechanical engineer caught with a "sophisticated" cannabis farm in his attic by an electrician avoided jail on Friday.

Liam Esler, 37, was snared with a total of up to £7,100 of the drug at the flat in Glasgow's Whiteinch on January 20 2022.

The city's Sheriff Court heard that the local housing association carried out electrical work in the area.

Prosecutor Mark Allan said: "The electrician gained access to the loft space above Esler's flat.

"This was where they identified a cannabis cultivation.

"The growth area was well established - it was a professionally installed cultivation with fans.

"What that leads to is a reasonably sophisticated cultivation."

A total of 16 plants were recovered which are valued between £3,200 and £3,600.

A further 360 grams of cannabis was discovered from the kitchen valued between £2,000 and £3,500.

First offender Esler pleaded guilty to producing cannabis.

John Kilcoyne, defending, told the court: "He is a mechanical engineer, his wife is a nurse and they have two children.

"He said he has used cannabis for a significant period of time as he had cancer in 2012 and recovered in 2015.

"He used cannabis oil and he said that cannabis helps with his sleep and anxiety.

"He said during covid, it was difficult to get cannabis and he got the equipment online - the cultivation was for personal use."

Esler, now of the city’s Partick, was ordered to do 150 hours of unpaid work and put under supervision for 12 months by Sheriff Paul Reid.