Four British Columbia residents had challenged the regulations, which said patients could only get marijuana by purchasing it from licensed producers. (Just before the law took effect in April 2014, the court allowed people already authorized to possess medical marijuana to continue growing it at home until the constitutional challenge was settled.)

The regulations made medical marijuana unaffordable, attorney John Conroy argued during the hearings last year, according to the Canadian Press. Low-income patients not covered by the exemption were forced to either illegally grow their own or purchase cheaper cannabis on the black market.

Federal lawyers had countered that the regulations protected medical marijuana users by making sure the cannabis they bought met certain safety standards.

But Phelan disagreed.

“The access restrictions did not prove to reduce risk to health and safety or to improve access to marijuana — the purported objectives of the regulation,” he wrote.