Colorado is a state where many residents legally use marijuana. It is also a state where companies can fire employees for using the drug, even if that occurred when the person wasn’t at work.

The Colorado Supreme Court ruled Monday that a business can fire an employee for using medical marijuana even if the employee is off-duty and abiding by state law, a decision that could have far-reaching ramifications in a state that has decriminalized most marijuana use.

The justices said that employees can still be fired because marijuana remains illegal in the eyes of the federal government, making this case a high-profile example of the sharp divide between state laws and the federal law. This chasm affects nearly two dozen states that allow legal medical marijuana, as well as a growing effort across the country to legalize recreational marijuana, following in the footsteps of Colorado and other states.

While the ruling does not specifically mention Colorado’s highly publicized and thriving recreational marijuana industry, focusing instead on medical marijuana, it could reverberate across a state that allows anyone 21 and older to legally buy and use marijuana.

In Colorado, about one in seven residents said they use marijuana, according to data released Monday by the state Department of Public Health and Environment. And about a third of the people who defined themselves as current marijuana users last year said they used it daily.

The opinion released Monday dealt with an employee who was fired because he used medical marijuana. Under Colorado state law, it is considered discriminatory “for an employer to terminate the employment of any employee due to that employee’s engaging in any lawful activity off the premises of the employer during nonworking hours.”

In the case, Coats v. Dish Network, Brandon Coats argued that the satellite provider violated this statute by firing him for using medical marijuana after work, because he was acting in accordance with Colorado law. Coats is a quadriplegic who has used a wheelchair since he was a teenager, according to court filings, and he obtained a medical marijuana license in 2009.

Coats worked for Dish until 2010, when he tested positive for tetrahydrocannabinol (or THC, the active mind-altering ingredient in marijuana) during a random drug test. He was fired for violating the company’s drug policy.

A trial court dismissed Coats’s claim that he had been wrongfully terminated, and an appeals court upheld that decision. The state’s Supreme Court, in an opinion delivered by Justice Allison H. Eid, agreed with the lower courts, determining that despite the state law, Coats’s marijuana use can’t be considered lawful because it violates federal law.

The Colorado statute does not define what is a “lawful” activity, Eid wrote, and while Coats argued that it should cover things legal under Colorado law, she said the justices disagreed.

“As a national employer, Dish remains committed to a drug-free workplace and compliance with federal law,” Dish Network said in a statement praising the decision.

Michael Evans, an attorney for Coats, called the decision was “devastating” and said the state’s legislature must act to keep people from needing medical marijuana from having to choose between using the drug and their work.

“Although I’m very disappointed today, I hope that my case has brought the issue of use of medical marijuana and employment to light,” Coats said in a statement released through Evans’s firm. “If we’re making marijuana legal for medical purposes we need to address issues that come along with it such as employment.”

Coats worked as a telephone customer service representative who only used marijuana after work hours and at home, Evans’s firm said.

Advocates of reforming drug policy said the case highlighted the problematic gray areas that exist between state and federal law.

“It’s now painfully clear that something akin to a medical marijuana bill of rights is needed for patients in Colorado,” Art Way, state director for the Drug Policy Alliance in Colorado, said in a statement e-mailed to The Post. “We need robust state protections for our patients and legal adult marijuana users, just as we have robust regulations for the marijuana industry.”

Recreational marijuana became legal in Colorado last year, after voters in 2012 approved a constitutional amendment making that state and Washington the first in the country to legalize retail sales of the drug for personal use.

Meanwhile, medical marijuana is allowed in nearly half the states in the country, with 23 states and Washington, D.C. allowing legal medical marijuana, according to the National Conference of State Legislatures.

In Colorado, medical marijuana has been allowed since 2001, when a constitutional amendment went into effect allowing “persons suffering from debilitating medical conditions” to possess and use marijuana.

That constitutional amendment does not require employers “to accommodate the medical use of marijuana in any work place.” However, it does not explicitly state what happens when medical marijuana is used by employees outside the workplace.

But the federal government still deems marijuana a Schedule I substance, considered by the Drug Enforcement Administration to be “the most dangerous drugs” they classify, along with heroin, LSD and peyote.

In 2009, David W. Ogden, a deputy attorney general, wrote in a memo that prosecuting people with serious illnesses who use medical marijuana “is unlikely to be an efficient use of limited federal resources.”

Rather, the memo said, the Justice Department would remain focused on entities that illegally sell marijuana instead of people who “are in clear and unambiguous compliance with existing state laws” governing medical marijuana.

This post has been updated. First published: 12:16 p.m.