I am a strong advocate for medical marijuana. I've seen the need and know it works. While I am not as confident about legalization of pot, if it were put to a vote, I'd vote to legalize.
However, Ian_Y is the reason why cops hassle people who legitimately need the drug. I'm not going to second guess his doctor, but I shake my head and call rubbish. The law was designed to allow seriously ill people legal access to a powerful medicine. I simply don't believe Ian_Y is using as the law intended, but using the law as a dodge for his drug habit.
I'm glad, in this instance, the protection is an affirmative defense the OP must plead. For my legal advice, whenever one must plead in a criminal matter, an attorney is recommended.
When you are a Bear of Very Little Brain, and you Think of Things, you find sometimes that a Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it.
--W. T. Pooh (aka A. A. Milne)