BOSTON (Reuters) - Massachusetts’ top court on Monday ruled that a woman who had been fired for testing positive for marijuana that she had been legally prescribed under state law could sue her former employer for handicap discrimination.

The Massachusetts Supreme Judicial Court rejected the former employer’s argument that she could not sue it for handicap discrimination because possessing marijuana remains illegal under federal law.

Lawyers for the former employee, Christina Barbuto, said the ruling represents a major win for employees in the state and set a precedent that they said could have an impact in other states where medical marijuana is legal.

Barbuto had accused Advantage Sales and Marketing of firing her after her first day of work because she tested positive for the drug, which she had been prescribed by a doctor to treat low appetite, a side effect of her Crohn’s disease.

Chief Justice Ralph Gants wrote that if a doctor concludes medical marijuana is the most effective treatment for an employee’s debilitating condition, “an exception to an employer’s drug policy to permit its use is a facially reasonable accommodation.”

“The fact that the employee’s possession of medical marijuana is in violation of federal law does not make it per se unreasonable as an accommodation,” Gants wrote.

The unanimous six-judge panel’s ruling noted that only the employee, not the company, could have been subject to prosecution under federal law for her drug use.

Massachusetts voters approved the medicinal use of marijuana in 2012, joining the majority of U.S. states that allow for the drug’s medical use. State voters in November went further, legalizing recreational use of marijuana.

Matthew Fogelman, Barbuto’s lawyer, called the ruling a “groundbreaking decision.”

“This is the highest court in Massachusetts recognizing that the use of medically prescribed marijuana is just as lawful as the use of any prescribed medication,” he said.

The ruling reversed a decision that dismissed Barbuto’s 2015 handicap discrimination claim against the company. It upheld the dismissal of other claims.

Michael Clarkson, a lawyer for the company, said it was considering its options. He said the company’s lawyers are “confident that our client acted in accordance with the law.”

Barbuto said in her lawsuit that she had been prescribed medical marijuana to treat her Crohn’s disease, which coupled with irritable bowel syndrome, left her with little appetite.

After she started using marijuana, Barbuto said she was able to maintain a healthy weight.