Q: If I see a dog in the car obviously suffering, is it illegal to break the window to save the dog? What if it is a child?

Lori, Sacramento

A: Authorities say you are on more solid legal ground if you seek to remove a child in distress from a vehicle.

Chris Cochran, a spokesman for the California Office of Traffic Safety, which routinely warns against leaving a child in a car in hot weather, said he was not aware any criminal proceedings against people who have acted to rescue a child in such circumstances.

He noted that the California Vehicle Code says it is illegal to leave a child 6 or younger unattended in a vehicle. The state’s Good Samaritan law also affords someone rescuing a child in an emergency some protection from civil liability, he said.

Scott Heiser, an attorney and director of criminal justice programs for the Animal Legal Defense Fund, said that rarely are such circumstances involving animals codified by states. But he said courts have supported the notion that an animal’s life is worthy of protection. He cited a California case in which it was determined that police did not violate search and seizure laws when they entered a residence without a warrant when a dog was believed to be in distress.

It is unlikely, Heiser said, that a prosecutor would pursue criminal charges “as long as there are good, clear facts. It’s got to be compelling circumstances.”

The harm you are preventing, he said, must be greater than the harm you are causing.

Authorities advise anyone who sees a child or animal alone in a hot vehicle to immediately call 911. They warn that leaving a child or an animal in a hot car, even for a few minutes, can be fatal.