A 62-year-old builder who set up a cannabis factory to supplement his falling income has been jailed for two and a half years.

Michael Smith, who also had a gambling habit, used his skills to set up the enterprise at a farm in Bradford Leigh.

He had almost 200 plants growing in two rooms in an outbuilding which could have netted £90,000 worth of the drug.

The court heard that there had already been a harvest of an earlier crop, though it had not been as successful as the plants were not mature enough.

A judge sitting at Swindon Crown Court, noted that he only stopped because he was caught and his skills would have improved with time.

The court was told that a number of rooms at the farm building had been converted for the production of cannabis when it was raided in January.

Smith was running two of them, with 101 juvenile plants in one room and 95 established plants in the other. Had they been grown and harvested in optimum conditions they could have made 9kg of the drug, which in small street deals can fetch up to £10,000 a kilo.

Cannabis was also being grown in another two rooms and it was found electrician Adam James had set up the lighting for them. Some of the plants had bee hidden in a room behind a ‘secret door’.

The court heard that 89 plants were being grown there which could have yielded 3.7kg for their owner, who was not James.

Smith, formerly of Main Street, Keevil but now living in Trowbridge, admitted producing a controlled drug of class B between June 2011 and January 26 this year. James, of Skylark Road, Melksham, had pleaded guilty to being concerned in the production of a class B drug in October.

The court was told that both men were full of remorse for what they had done.

Passing sentence Judge Euan Ambrose told Smith “You saw the running of these rooms as a way of making easy money. You took a calculated risk and you have been caught."”

Jailing James for six months he said “You were involved in setting up the equipment, not the same operation Mr Smith was running but different rooms at the premises.

“You are someone who has a short but highly relevant list of previous convictions. Most significantly, possession of cannabis with intent to supply in 2010 for which you received a suspended sentence of imprisonment.

“You were therefore not a hapless electrician brought in to put up some lighting without any involvement in what you were getting involved in.”

Proceedings under the Proceeds of Crime Act were also started, so the authorities can try to reclaim any profits the pair made from crime.