Talking on a cellphone while driving, get a ticket. Text while driving, get a ticket. Glance at that all-powerful map on your iPhone while driving? No problem.

That was the conclusion Thursday of a state appeals court in Fresno, which for the first time in a California case found that drivers can use maps on their smartphones without risking a hands-free cellphone ticket.

The court’s ruling is almost certain to be welcomed by drivers who’ve come to depend on maps programs and GPS functions to get where they’re going, but it is unlikely to end the confusion over what’s legal — and what’s not — under California’s hands-free law.

Since the law took effect in 2008, the Legislature has repeatedly changed it, instituting a texting ban and making its provisions tougher on teenage drivers. And it leaves drivers wondering: If a paper map is OK, why not an electronic one? If I can fiddle with my radio, why not Pandora on my phone?

For its part, the California Highway Patrol said Thursday that any of those distractions can still lead to a ticket.

The CHP said that a driver paying too much attention to a little screen and not the road can be cited for distracted driving — which carries fines similar to that of the hands-free law.

“As with every ruling, the department will see if any action is needed, but we will continue our enforcement the way we do it,” said CHP spokesman Sean Wilkenfeld.

He said drivers can be cited for anything an officer considers a distraction, such as reading a magazine, drinking a latte, fussing with kids in the back seat — or poking around on a mapping device.

“Anything that makes a driver take their eyes off the road can be considered unsafe,” Wilkenfeld said. “That’s a half-second that you’re not looking, and that can mean the difference between having a collision and not having one.”

Thursday’s ruling stems from a legal challenge by Steven Spriggs, a Fresno man who fought a $165 ticket for using the map on an iPhone. A CHP officer pulled over Spriggs while he was driving in heavy traffic and slapped him with a citation for violating vehicle codes barring cellphone use unless it is hands-free.

But the 5th District Court of Appeal concluded that the Legislature never intended the law to cover looking at a cellphone map, reversing Spriggs’ conviction.

“Spriggs contends he did not violate the statute because he was not talking on the telephone. We agree,” the appeals court wrote. “We conclude the statute means what it says — it prohibits a driver only from holding a wireless telephone while conversing on it.”

Spriggs agreed that distracted driving is dangerous behavior. He uses a hands-free device to talk and drive and has a son whose leg was broken in an accident with a driver who was chatting on a cellphone.

“We’re distracted all the time,” he told The Associated Press. “If our distractions cause us to drive erratically, we should be arrested for driving erratically.”

In his case, he was delayed by roadwork and was looking at his cellphone to find a different route when pulled over and given a ticket. He lost a challenge in traffic court and an appeal in Fresno County Superior Court before taking it to the appellate court.

While the appeals court ruling sets statewide legal precedent for now, it is far from the final word in the courts. Other appeals courts could take up the issue and come down with conflicting rulings. And the California Supreme Court could take up the case if the state appeals or the Legislature could step in and amend the law.

Attorney General Kamala Harris’ office defended the law in the Fresno case, arguing that existing vehicle codes ban all hand-held use of cellphones, including maps. The court disagreed, saying the state’s position “would lead to absurd results.”

Automotive and traffic safety groups, meanwhile, agreed that the best policy is to drive without such distractions regardless of legal decisions.

“If someone uses a GPS, they should set it prior to leaving for their destination, and if they need to change it pull over,” said Chris Cochran, spokesman for the California Office of Traffic Safety. “The interpretation of the law is up to the court — our mission is to talk about safety and the safest thing is not to use a cellphone.”

The Associated Press contributed to this story. Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz