PHOENIX—An appeals court has issued a ruling that upholds the right of authorities to prosecute pot smokers in Arizona for driving under the influence even when there is no evidence that they are actually high.

The ruling by the Court of Appeals focuses on the chemical compounds in marijuana that show up in blood and urine tests after people smoke pot. One chemical compound causes drivers to be impaired; another is a chemical that stays in people’s systems for weeks after they’ve smoked marijuana but doesn’t affect impairment.

The court ruled that both compounds apply to Arizona law, meaning a driver doesn’t have to actually be impaired to get prosecuted for DUI. As long as there is evidence of marijuana in their system, they can get a DUI, the court said.

The ruling overturns a decision by a lower court judge who said it didn’t make sense to prosecute a person with no evidence they’re under the influence.

The lower court judge cited the proliferation of states easing their marijuana laws, but the Court of Appeals ruling issued Tuesday dismissed that by saying Arizona’s medical marijuana law is irrelevant regarding DUI. More than 35,000 people in Arizona have medical marijuana cards.

The Court of Appeals said the Legislature adopted the decades-old comprehensive DUI law to protect public safety, so a provision on prohibited substances and their resulting chemical compounds should be interpreted broadly to include inactive compounds as well as active ones.

The case stems from a 2010 traffic stop in Maricopa County. The motorist’s blood test revealed only a chemical compound that is found in the blood after another compound produced from ingesting marijuana breaks down.

According to testimony by a prosecution criminalist, the compound found in the man’s blood doesn’t impair the ability to drive but can remain detectable for four weeks.

The man’s lawyer argued Arizona’s DUI law bars only marijuana and “its metabolite,” so only the first derivative compound that actually impairs drivers is prohibited.

Two lower court judges agreed, with one upholding the other’s dismissal of the case against the motorist, Hrach Shilgevorkyan.

Superior Court Commissioner Myra Harris’ ruling noted that several states have decriminalized pot, and that a growing number of states, including Arizona, have legalized medical marijuana.

“Residents of these states, particularly those geographically near Arizona, are likely to travel to Arizona,” Harris said in her 2012 ruling upholding the dismissal. “It would be irrational for Arizona to prosecute a defendant for an act that might have occurred outside of Arizona several weeks earlier.”

However, the Court of Appeals sided with prosecutors who appealed, saying that allowing the testing for marijuana’s active compound would unduly restrict law enforcement.

The ruling said it serves the Legislature’s intention to have a flat ban on driving under the influence to interpret the DUI law’s reference to a prohibited substance and “its metabolite” as covering both a substance’s active and inactive compounds.

Michael Alarid III, a lawyer for Shilgevorkyan, said he’ll ask the Arizona Supreme Court to consider an appeal.

He added the testing issue is increasingly important because people legally using pot in two Western states that last year approved pot decriminalization laws—Washington and Colorado—could be convicted of DUI if arrested while driving in Arizona weeks later.

Michael Walz, a Phoenix attorney who specializes in defending people charged with violating marijuana laws but doesn’t represent Shilgevorkyan, said Tuesday’s decision officially backs up a practice that authorities in Arizona have been using for years.

But he predicted the ruling eventually will be overturned.

Walz said the decision runs counter to the Legislature’s wishes, and that the state’s medical marijuana law gives cardholders immunity from DUI convictions based solely on the presence of metabolites in a person’s system that don’t appear to be enough to cause impairment.