Updated

Employers can fire workers found to have used medical marijuana even if it was legally recommended, the California Supreme Court ruled Thursday in another setback for California in its increasingly rancorous clash with federal law over medical pot use.

The high court upheld a Sacramento telecommunications company's firing of a man who flunked a company-ordered drug test. Gary Ross held a medical marijuana card authorizing him to legally use marijuana to treat a back injury sustained while serving in the Air Force.

The company, Ragingwire Inc., successfully argued it rightfully fired Ross because all marijuana use is illegal under federal law, which does not recognize the medical marijuana laws in California and 11 other states.

"No state law could completely legalize marijuana for medical purposes because the drug remains illegal under federal law," Justice Kathryn Werdegar wrote for the 5-2 majority.

The court also said the so-called Compassionate Use Act passed by California voters in 1996 had nothing to do with employment laws.

"Under California law, an employer may require preemployment drug tests and take illegal drug use into consideration in making employment decisions," Werdegar wrote.

A 2005 U.S. Supreme Court decision declared that state medicinal marijuana laws don't protect users from prosecution. The Drug Enforcement Agency and other federal agencies have been actively shutting down major medical marijuana dispensaries throughout the state over the last two years and charging their operators with serious felony distributions charges.

Ragingwire said it fired Ross because, among other reasons, it feared it could be the target of a federal raid.

The Santa Clara Valley Transportation Authority and the Western Electrical Contractors Association Inc. had joined Ragingwire's case, arguing that companies could lose federal contracts and grants if they allowed employees to smoke pot.

The conservative nonprofit Pacific Legal Foundation said in a friend-of-the-court filing that employers could also be liable for damage done by high workers.

"This decision promotes employer efforts to make safe, drug-free workplaces," said Foundation lawyer Deborah LaFetra.

Ross had argued that medical marijuana users should receive the same workplace protection from discipline that employees with valid painkiller prescriptions do.

The nonprofit marijuana advocacy group Americans for Safe Access, which represents Ross, estimates that 300,000 Americans use medical marijuana. The Oakland-based group said it has received hundreds of employee discrimination complaints in California since it began tracking the issue in 2005.

Safe Access attorney Joe Elford said the group will now focus on getting the Legislature to pass a law protecting medical marijuana users in the work place.

"Obviously, we are extremely disappointed by the ruling," he said. "But we remain confident that there will be a day when medical marijuana patients are not discriminated against in the workplace."

In her dissent, Justice Joyce Kennard said the ruling was "conspicuously lacking in compassion" and "disrespects" the California medical marijuana law. She said employers should be barred from firing workers who use medical marijuana if they perform their jobs adequately.

Kennard was joined in the dissent by Justice Carlos Moreno.

The American Medical Association advocates keeping marijuana classified as a tightly controlled and dangerous drug that should not be legalized until more research is done.