Maine’s highest court ruled Thursday that federal laws prevent an employer’s workers compensation fund from being forced to pay for medical marijuana treatments.

The court, in a 5-2 vote, said its ruling should be considered narrowly, based on a case in which a paper company employee wanted his employer’s worker’s compensation fund to pay for his use of medical marijuana to treat pain from a back injury.

The worker, who suffered a total disability, filed a claim six years ago, seeking to have the company, Twin Rivers in Madawaska, pay for his medical marijuana after his use of prescription painkillers provided him no relief. The company refused, saying that the federal Controlled Substances Act barred it from paying for marijuana.

The Maine Workers Compensation board had sided with the worker, Gaetan Bourgoin, but the company went to court to try to overturn the ruling.

The Supreme Court based its ruling primarily on the supremacy clause of the Constitution, which said that in conflicts between state and federal laws, federal law should prevail. Two justices dissented.

The ruling notes that Maine law exempts patients from prosecution under state laws for their use of marijuana. But, it said, ordering an employer to reimburse and employee for the purchase of medical marijuana “is hereby required to commit a federal crime (as) defined by the Controlled Substances Act.”

That creates a conflict between state and federal law, the court said, and the Constitution said federal laws take precedence.

This story will be updated.