A federal court judge in Vancouver has ruled that patients have the constitutional right to grow their own cannabis, striking down a ban introduced by Canada's previous Conservative government.
The court suspended its decision for six months to give Ottawa time to respond.
A group of British Columbia residents took Canada to court in 2013, arguing a new law requiring medical cannabis patients to buy their cannabis from licensed producers, instead of growing their own, was unconstitutional.
They said cannabis grown under the government system was too expensive and did not allow them to control the strains and dosages of their treatment.
The government, which overhauled its medical cannabis program in 2013, argued that its mail order system was safer for both the patient and other Canadians, who could be negatively impacted by unsafe home grow-ops.
In his decision, Federal Court Judge Michael Phelan said that restrictions imposed by the Marihuana for Medical Purposes law were arbitrary.
"The access restrictions did not prove to reduce risk to health and safety or to improve access to marihuana - the purported objectives of the regulation," he wrote.
The Canadian government must now decide if it will appeal the decision.
Prime Minister Justin Trudeau, elected in October, pledged during his campaign to regulate and legalise recreational cannabis, though his ruling Liberals have not addressed their plans for medical cannabis at length.
Last June, Vancouver city councillors voted to license cannabis dispensaries, which operate outside the current federal framework, becoming the first Canadian city to regulate retailers selling the drug.