WASHINGTON – A unanimous Supreme Court ruled Thursday that people accused of selling synthetic drugs can’t be convicted unless prosecutors show they knew the substance was prohibited by law.

The ruling could make it tougher for prosecutors to convict people selling a new wave of drugs designed by rogue chemists to produce a high, but with slight chemical modifications that keep them off state and federal banned drug lists.

The justices sided with Stephen McFadden, a New York City man convicted of supplying bath salts to a store in Charlottesville, Virginia, in plastic bags or vials with names like “Speed,” “No Speed” and “The New Up.”

McFadden was convicted in 2013 of violating the Controlled Substance Analogue Enforcement Act, which punishes those who knowingly or intentionally sell a controlled substance or analogue – a knock-off that has a “substantially similar” chemical structure and mimics the effect of a banned substance.

A federal appeals court ruled it was enough for a jury to find that McFadden intended the bath salts for human consumption. But McFadden argued that the government had to prove he knew the bath salts were similar in both chemical structure and effect to a controlled substance.

Writing for the court, Justice Clarence Thomas said prosecutors must prove either that a defendant knew the substance was a “controlled substance” banned under federal drug laws or that he knew it was an “analog” with a chemical structure substantially similar to that of a banned drug.

The Supreme Court sent the case back to the appeals court to determine whether the incorrect jury instruction was harmless, meaning that McFadden’s conviction could still be upheld.

Prosecutors had pointed to telephone recordings of McFadden’s conversations with the store owner in Virginia in which he discussed which of his products was the “most powerful” and gave the most “intense” feeling. He also compared the effects to meth and cocaine.

McFadden’s lawyers say the law was designed to target clandestine chemists who design the analogues, not street-level distributors who don’t understand the chemical makeup of the substance and may not realize what they are selling is substantially similar to controlled substances.

Justice Department lawyers argued that the law was meant to curb the flow of illegal drugs and knock-offs. They say McFadden’s reading of the law would unfairly hinder law enforcement’s ability to go after distributors.