WASHINGTON (CNN) -- Workers who are legally prescribed marijuana to treat illness can still be fired from their jobs, following a ruling Thursday from the California Supreme Court.

Medical marijuana user Angel Raich, 41, had her pot confiscated while her case was appealed.

The 5-2 decision upheld the job termination of Gary Ross, who flunked a company drug test shortly after being hired at a telecommunications firm.

A state referendum that allows people to use medical marijuana with a physician's recommendation are immune from some state criminal drug possession charges. But the state high court said such legal protection only goes so far.

"Nothing in the text or history of the Compassionate Use Act suggests the voters intended the measure to address the respective rights and duties of employers and employees," wrote Justice Kathryn Mickle Werdegar. "Under California law, an employer may require pre-employment drug tests, and take illegal drug use into consideration in making employment decisions."

The court agreed with RagingWire Telecommunications' contention it had a right to fire Ross because any marijuana use is illegal under separate U.S. law. The company said its work across state borders could put it in legal jeopardy from federal labor standards involving the conduct and production of its work force.

The U.S. Supreme Court has said the Bush administration can prohibit the backyard cultivation of pot for personal use, because such use has broader social and financial implications.

A federal appeals court last March said medical marijuana users can be subject to arrest and confiscation of the material, under federal anti-drug laws.

The issue is being closely watched because of the obvious conflict between state and federal laws over the use of medical marijuana. Various courts have said the federal Controlled Substances Act does not violate state autonomy.

The latest case involves Ross' back problems stemming from injuries sustained when he served in the U.S. Air Force. He received a physician's recommendation to use pot in 1999 and presented a card certifying his use of the narcotic when he took the employment drug test in 2001.

Ross said his condition does "not affect his ability to do the essential functions of the job" his former employer hired him to do, according to his original complaint.

The Sacramento-based company said its no-tolerance policy applies to all workers, since potential "abuse of drugs and alcohol" could lead to "increased absenteeism, diminished productivity, greater health costs, increased safety problems, and potential liability to third parties," according to the company's lawyers.

Ross' job performance was not at issue in the case.

The state supreme court said the law allowing use of marijuana for some patients is "modest" in scope, limiting the rights of some patients.

The U.S. Supreme Court ruling in 2005 for the Bush administration giving it broad authority to crack down on illegal drug use was criticized by patient rights groups and the movement to legalize marijuana.

"Congress' power to regulate purely activities that are part of an economic 'class of activities' that have a substantial effect on interstate commerce is firmly established," wrote Justice John Paul Stevens.

Under federal law, the Controlled Substances Act prevents the cultivation and possession of marijuana, even by people who claim personal "medicinal" use. The federal government has argued its overall anti-drug campaign would be undermined even by limited patient exceptions.

That high court case involved a separate lawsuit from a pot patient from Oakland, California, who has a variety of medical conditions, including a brain tumor. Angel Raich had her pot confiscated and was not allowed to use it while her case was appealed.

The Drug Enforcement Administration began raids in 2001 against patients using the drug and their caregivers in California.

Along with California, 11 other states have passed laws permitting marijuana use by patients with a doctor's approval: Alaska, Colorado, Hawaii, Maine, Montana, Nevada, New Mexico, Oregon, Rhode Island, Vermont and Washington. Arizona also has a similar law, but no formal program in place to administer prescription marijuana.

California's Compassionate Use Act permits patients with a doctor's approval to grow, smoke or acquire the drug for "medical needs."

Users include television host Montel Williams, who has multiple sclerosis. E-mail to a friend

All About U.S. Supreme Court • Medical Marijuana