SAN FRANCISCO — A federal appeals court says there is ample evidence for a jury to conclude that a California teenager carrying a toy gun did not pose an immediate danger to a sheriff’s deputy who shot and killed him.

A divided three-judge panel of the 9th U.S. Circuit Court of Appeals on Friday refused to find Sonoma County Sheriff’s Deputy Erick Gelhaus exempt from liability for the 2013 shooting of 13-year-old Andy Lopez in Santa Rosa.

Ninth Circuit Judge Milan Smith said there was evidence to support a lower court’s determination that the barrel of Lopez’s toy gun may not have risen to a level that posed a threat to the deputy.

The ruling kept a lawsuit filed by Lopez’s family against Gelhaus and Sonoma County alive.

Noah Blechman, an attorney who represented the county, said the ruling was at odds with several U.S. Supreme Court decisions.