Another ex-employee has won in court after losing their job due to their authorized possession and use of medical marijuana. It’s a story that’s repeating itself across the country. So much so, in fact, that New York lawmakers want to ban most workplace THC tests the moment the state legalizes marijuana. This time, however, the story involves an Arizona Walmart that fired an employee in 2016 because she tested positive for cannabis. But last week, an Arizona judge ruled that Walmart discriminated against the woman when it terminated her for her medical marijuana use. Importantly, the judge’s ruling sets a key legal precedent for medical cannabis patients in Arizona.

Arizona Judge Rules That Drug Tests for THC Can’t Determine Impairment

Carol Whitmire is in her 50s. She worked at Walmart for eight years before her manager fired her. And for the last five years, Whitmire has been a registered medical cannabis patient in Arizona. Whitmire told the court that she used medical cannabis to treat her chronic shoulder pain and arthritis and as a sleep aid. She says she consumed cannabis before bed and never brought her medication to work or showed up under the influence.

But on May 21, 2016, Whitmire suffered an injury at work—at Walmart. A bag of ice fell on her wrist as she was arranging the bags in a cooler. The injury prompted an urgent care visit. And under Walmart policy, such incidents require drug testing any employee involved. Knowing the policy, Whitmire contacted Walmart human resources. She told them about the incident, her injury, and her status as a registered medical cannabis patient.

Walmart suspended Whitmire anyway, on July 4, 2016, after her urine sample tested positive for cannabis metabolites. On July 22, Whitmire’s manager fired her. It would take Whitmire until March 2017 to put together a discrimination complaint against Walmart with the Equal Employment Opportunity Commission. The charge of discrimination also involved the Arizona Attorney General’s Office. A lawsuit followed three months later. It alleged Walmart wrongfully terminated Whitmire and discriminated against her in violation of the Arizona Medical Marijuana Act.

Last week, U.S. District Judge James A. Teilborg ruled that Walmart was not justified in firing Whitmire because the company’s assumption that she was impaired at work due to the presence of cannabis metabolites in her urine is unjustifiable. In other words, the judge recognized that the presence of metabolized THC in a person’s body is no indication of being under the influence of cannabis’ psychoactive effects.

Key Arizona Court Ruling Upholds Patient Protections Under Arizona’s Medical Marijuana Act

The ruling isn’t just a big win for Whitmire. It also sets a crucial legal precedent across Arizona. Whitmire’s attorney Joshua Carden says Judge Teilborg’s decision is the first of its kind in the state. “No court has officially decided whether a private right-of-action exists under the Arizona Medical Marijuana Act,” Carden said. “So that was a big part of the decision.”

Arizona’a Medical Marijuana Act (AMMA) establishes protections for employees with medical cannabis cards. The law says it is illegal for an employer to discriminate in hiring or firing based on a patient’s “positive drug test for marijuana components or metabolites.” The only time the AMMA doesn’t protect a patient is in the event that they possess or are impaired by cannabis at work or on-the-clock.

Walmart denied wrongfully terminating or discriminating against Whitmire. In court, the company said its drug testing policy is legal under the Arizona Drug Testing of Employees Act (DTEA). But that point is irrelevant. The AMMA and the DTEA aren’t in conflict. The problem for Walmart was that the company had no way to prove that Whitmire’s positive drug test meant she was impaired at work.

Ultimately, the judge’s decision will make it much easier for medical cannabis patients who face termination or other workplace sanctions to challenge their employers in court.