Being a medical marijuana patient may be hazardous to your job status, despite state antidiscrimination laws designed to offer some protections.

A New Jersey forklift operator, Daniel Cotto Jr., learned that the hard way.

On Monday, a federal court judge ruled that Cotto's employer did not discriminate when it refused to waive its drug test requirement before Cotto returned to work. Because Cotto, a medical marijuana patient, would have been fired if he took the test, he asked to have it waived. His employer placed him on "indefinite suspension."

Cotto began driving a forklift in 2011 for Ardagh Glass Packing Inc. of Bridgeton, Cumberland County. To treat his neck and back pain, Cotto has long had a prescription for the narcotic Percocet and a doctor's recommendation for medical cannabis, according to court documents.

In 2016,  Cotto banged his head on a piece of work machinery and a supervisor sent him to see a doctor. The doctor placed Cotto on "light duty." But to return to his job, Cotto had to pass a drug and urine test.

Ardagh Glass Packing had no problem with Cotto's use of the opioid Percocet. But if the tests detected marijuana, Cotto would fail the test and be fired.

Cotto appealed and sought "reasonable accommodation." He said he could perform all the essential functions of his job, and asked the company for an exemption. Cotto said he could wean himself off the Percocet, but needed the medical marijuana to function. The company refused. New Jersey is an at-will employment state: a company may fire an employee for good reason, bad reason, or no reason at all. But state law also forbids firing an employee due a disability.

Marijuana is legal in some form in 30 states and the District of Columbia. But it remains "an illegal narcotic" in the eyes of the federal government, which considers the drug to have no accepted medical use, despite its recent approval by the FDA for use to treat some forms of epilepsy.

Ardagh Glass Packing argued that the New Jersey Compassionate Use Medical Marijuana Act (CUMMA) does not require employer acceptance  of an employee's use of a substance that is illegal under federal law,  or, more specifically, the waiving of a drug test.

Cotto, who claimed he could still do the job, said his pain was a disability and filed a discrimination suit. A panel of judges in U.S. District Court in Camden was not convinced and ruled for Ardagh Glass Packing.

In his Aug. 10 opinion, U.S. District Judge Robert Kugler wrote that the company did not discriminate against Cotto based on his disability. But the company was within its rights in taking issue with the treatment of the disability, namely, Cotto's use of medical marijuana.

"Ardagh Glass is within its rights to refuse to waive a drug test for federally prohibited narcotics," Kugler wrote.