Davis said the drug helps ease pain in his nerve-damaged legs and makes it easier to sleep.

According to the lawsuit filed in March in state court in Newark, Davis was bumped from his job as a procurement clerk by a more senior employee in December. He applied for a position in the field as a railroad block operator.

When he went to a required physical for the job, he said, he was told it would require a drug test.

He said he disclosed that he was using medical marijuana as a treatment recommended by a doctor, and that he was willing to apply for a different position — one not deemed safety-sensitive like the block operator position — if that was a problem. His lawyer said he never drove buses or trains and did not go to work while high.

But he said the agency's medical director told him he had to be given a drug test after his admission. When it came back as positive, he says, he was told he could not work at any job for the agency unless he went to drug rehabilitation first.

NJ Transit spokesman John Durso told The Star-Ledger that even though the drug is legal for certain patients in the state, it's prohibited under Federal Railroad Administration and Federal Transit Administration guidelines. He said that the federal Transportation Department does not consider marijuana use to be acceptable, even when it's allowed by state law for people with medical conditions.