A drug user claimed dealers forced him to grow cannabis plants to pay off a £1000 debt, Livingston Sheriff Court heard.
Police officers raided the home of Iain Arthurs (39), of Westfield, just after he had harvested his plants.
They found the material left out drying.
The court was told that the officers also found various other equipment related to the cultivation of the class B drug. Arthurs, who appeared from custody, pleaded guilty to producing cannabis at his home on April 30 while on two separate bail orders.
He told the court he had an outstanding bill of £1000 to drug dealers.
He said that they had agreed to write the debt off if he grew the plants.
After listening to the circumstances, Sheriff Martin Edington jailed Arthurs for 20 weeks.