Edward McLean, 67, was caught with hundreds of pounds worth of amphetamine and Etizolam - so-called "street Valium" - in his car when police stopped him in George Street, Falkirk about 11.15 am on January 8, 2021.
Falkirk Sheriff Court heard he had been "looking flustered, repeatedly looking in his rear view mirror, and leaning forward and moving items around".
Officers then obtained a warrant and searched his flat in the town and found even more drugs, a "tick list", "snap bags", and scales.
Emergency Services Day: 999 crews take over Falkirk High Street
Falkirk 80s rockers reform to play first gig in 36 years
Rosebank: 31 Year Old Lowland single malt from original Falkirk distillery casks on sale for £1800
Bosses confirm Falkirk shoe shop closure
Resurfacing work leads to road closures in Grangemouth
Prosecutor Cheryl Clark said that all-in-all, amphetamine valued at up to £1600 and Etizolam tablets worth up to £2230 were seized.
Ms Clark said that according to a police expert, McLean had been involved in the supply of drugs at street level in the Falkirk area.
On Tuesday, McLean, of Seaton Place, Falkirk, pleaded guilty to be concerned in the supply of controlled drugs.
Defence solicitor Mark Fallon said McLean used to work full-time in a foundry but had suffered from lung cancer and had one lung removed.
Mr Fallon said: "He was described by his consultant as a walking miracle having survived for so long, but during the second part of his cancer treatment he suffered from misuse of drugs to help with sleeping, using Etizolam."
Mr Fallon said this had put McLean into "a substantial amount of debt".
Sheriff Christopher Shead said: "Regrettably, from the court's perspective there's only one sentence that can realistically be imposed."