PHOENIX — Arizonans who smoke marijuana can’t be charged with driving while impaired absent actual evidence they are affected by the drug, the Arizona Supreme Court ruled Tuesday.

The justices rejected arguments by the Maricopa County Attorney’s Office that a motorist whose blood contains a slight amount of a certain metabolite of marijuana can be presumed to be driving illegally because he or she is impaired, saying medical evidence shows that’s not the case.

The ruling most immediately affects the 40,000-plus Arizonans who are legal medical marijuana users. It means they will not be effectively banned from driving, given how long the metabolite, carboxy-THC, remains in the blood.

It also provides legal protection against impaired-driving charges for anyone else who drives and has used marijuana in the last 30 days — legal or otherwise — as well as provides a shield for those who might be visiting from Washington or Colorado, where recreational use of the drug is legal.

Maricopa County Attorney Bill Montgomery said Tuesday’s ruling will result in roads that are less safe. He said if courts will not accept carboxy-THC readings as evidence of impairment, then there is no way of knowing who is really “high” and who is not.

“We’re seeing across the United States that where states have some form of medicalization or legalization of marijuana, the number of impaired drivers due to marijuana goes up,” Montgomery said.

The court was ruling on the case of a driver cited for a traffic violation who, when given a blood test, was found to have carboxy-THC in his system. He was charged under a state law that makes it illegal to drive with an illegal drug or its metabolite registering in the body.

The Court of Appeals said the laws on impaired driving “must be interpreted broadly.”

In arguments to the high court, Susan Luder, a deputy Maricopa County attorney, acknowledged that carboxy-THC, a secondary metabolite of marijuana, can show up in blood tests for a month after someone has used the drug. And her own expert witness said the presence of that metabolite does not indicate impairment.

But Luder told the justices that the Legislature is legally entitled to declare a positive blood test for carboxy-THC can be used to prosecute someone who, if convicted, can lose a driver’s license for a year.

Justice Robert Brutinel, writing the majority ruling, said that argument makes no sense.

“This interpretation would create criminal liability regardless of how long the metabolite remains in the driver’s system or whether it has any impairing effect,” he wrote.

And Brutinel noted that even prosecutors acknowledge the metabolite itself does not cause impairment.

The judge also said the position being taken by prosecutors “would criminalize otherwise legal conduct.” He pointed to the 2010 voter-approved law allowing those with a doctor’s recommendation to buy and use up to 2½ ounces of marijuana every two weeks.

“Because carboxy-THC can remain in the body for as many as 28 to 30 days after ingestion, the state’s position suggests that a medical-marijuana user could face prosecution for driving anytime nearly a month after they had legally ingested marijuana,” Brutinel wrote. “Such a prohibition would apply even when the driver had no impairing substance in his or her body.”

In a dissenting opinion, Justice Ann Scott Timmer wrote, “The difficulty of detecting drug impairment justifies a flat ban.”

She said hydroxy-THC, the psychoactive element in the drug, converts quickly to carboxy-THC, which means by the time police are able to do a blood test, a motorist who tests positive for carboxy-THC may or may not have had hydroxy-THC in the blood while driving.