Delegates at the SNP conference have overwhelmingly backed a motion in favour of decriminalising cannabis for medical use.
Party members want the UK government to devolve power over the class B drug to the Scottish Parliament.
The Glasgow gathering heard from multiple sclerosis sufferer Laura Brennan-Whitefield who backed the lawful use of cannabis for pain relief.
Possession and supply of cannabis can lead to a jail term.
Ahead of the conference vote, Ms Brennan-Whitefield asked the party to show "compassion and common sense".
She added: "I have been living with multiple sclerosis for nine years and the fact that I'm standing here giving this speech means I am one of the lucky ones.
"It has become very clear to me over these last nine years that many people living with MS have been using cannabis to help with the symptoms of that condition, in fact it's one of the worst kept secrets at the hospital.
"All of these people risk a criminal record, unlike in Australia, Chile, Canada, Finland, France, Germany, Romania and some US states."
The resolution was backed by the majority of delegates at the conference hall.
However, Councillor Audrey Doig voiced her disapproval.
She told how her cousin had started using cannabis to relieve pain before moving on to harder drugs.
Councillor Doig added: "Nowadays people are looking for quick fixes as far as pain is concerned, and they look for quick fixes when the pain medication doesn't work and they go on to stronger pain killers.
"I'm afraid this would happen with this particular medication.
"How do I know this? I had a cousin who died a number of years ago in Canada. He started taking cannabis because he was having pain when he was playing ice hockey and his mates in ice hockey did the same.
"Unfortunately my cousin had an addictive personality and when the pain wasn't relieved by taking cannabis he went on to taking stronger drugs."
She said there were alternatives to pain medication including taking up keep-fit programmes.
Councillor Doig added: "That is the way to go, stop all these pain medications, go to fitness regimes, the doctors are trying it out now and it's working, it's working for heart patients, it's working for angina and it's working for MS patients too."