A Pennsylvania county's policy barring people on probation from using medical marijuana is unlawful, the state Supreme Court has ruled in a high-profile test of the 2016 law legalizing medicinal uses of the substance.

The justices on Thursday unanimously held in the case, captioned Gass v. 52nd Judicial District, Lebanon County, that Lebanon County's broad policy conflicted with immunities provided to patients under the Medical Marijuana Act. The court had taken up the matter under its plenary, or King's Bench, jurisdiction.

The ruling is a win for the American Civil Liberties Union, which argued to the justices last month that the MMA granted sweeping protections for medical marijuana users and did not create exceptions for criminal history or probation status.

Chief Justice Thomas Saylor, who wrote the court's 16-page opinion, said the language of the law was clear, and any policy concerns expressed by a county court system would best be addressed by the General Assembly.

"We are cognizant of the district's concerns that medical marijuana use by probationers may, in fact, cause difficulties with court supervision and treatment," he said. "Nevertheless, '[w]here the language of the governing statute is clear (or clear enough) … the solution is legislative — and not judicial — adjustment.'"

Reggie Shuford, executive director of the ACLU of Pennsylvania, said in an emailed statement that the ruling was a "major victory for people who rely on medical marijuana to treat their medical conditions."

"We are grateful that the justices understood the legislature's clear intent that people who lawfully use this treatment should not be punished for it," he said.

ACLU attorney Sara Rose represented the petitioners, and Robert Krandel of the Administrative Office of Pennsylvania Courts argued on behalf of Lebanon County's judicial district. An AOPC spokeswoman did not immediately comment on the ruling.

The ACLU brought the case on behalf of three people who were allegedly forced to stop using medical marijuana due to Lebanon County's policy barring those under court supervision from using the substance, even if it had been prescribed by a doctor. According to the ACLU, the petitioners Melissa Gass, Ashley Bennett and Andrew Koch used medically prescribed marijuana to treat a range of ailments, including seizures, post-traumatic stress disorder and chronic pain.

The challenge was initially filed in the Commonwealth Court's original jurisdiction, raising class action allegations and seeking declaratory and injunctive relief to invalidate the policy. The Commonwealth Court attempted to transfer the case to the Supreme Court, but after determining the transfer was improper, the justices decided to hear the case anyway in the court's King's Bench jurisdictions, which is primarily used to quickly address matters of statewide significance.

During last month's argument session, Lebanon's judicial district argued to the justices that courts in Pennsylvania need the power to bar a person's medical marijuana use so the probation department can take a holistic approach to its supervision when probationers suffer dependency issues. The district further argued that the policy did not go against the immunities the MMA provided to patients because the policy did not mean individuals would be penalized solely for their medical marijuana use.

The ACLU, however, argued that the MMA clearly states that people cannot be punished for using medically prescribed marijuana, and so the policy violated the plain language of the law.

Saylor agreed, but noted in the opinion that courts will still be able to inquire about the legality of a probationer's marijuana use.

"[N]othing impedes a revocation hearing or other lawful form of redress, where there is reasonable cause to believe that a probationer or other person under court supervision has possessed or used marijuana in a manner that has not been made lawful by the enactment," he said.