LOS ANGELES (CNS) — A state appeals court panel has upheld a man’s conviction for fatally beating his then-infant son’s maternal grandmother and attacking his ex-girlfriend with a pipe in Sylmar two years ago.

The three-justice panel from California’s 2nd District Court of Appeal rejected the defense’s contention that the trial court erred in admitting graphic photographs of 61-year-old Rosa Figueroa and her daughter, who was identified only as “Lisa Q,” during Juan Carlos Cardenas’ trial at the San Fernando courthouse.

The justices also turned down the defense’s claim that the trial court erred by excluding testimony from his ex-girlfriend — who gave birth to their son about four months before the Feb. 19, 2013, attacks — about whether he appeared to be under the influence of methamphetamine at the time.

At a hearing outside the jury’s presence, the woman said she didn’t know if he was on drugs the day of the crimes, according to the appellate court panel’s ruling.

Cardenas was convicted in November 2013 of first-degree murder for the attack on Figueroa, along with the attempted murder of his ex-girlfriend.

Cardenas struck Figueroa several times with a pipe he swung like a baseball bat, then chased after his ex-girlfriend, who was struck with the pipe after jumping over a fence to try to escape, the appellate court justices noted in the 22-page ruling.

A witness called 911 and pointed Cardenas out to officers, who arrested him.

Figueroa died from multiple blunt force injuries to the head, while her daughter suffered extensive facial fractures and other injuries.

Cardenas was sentenced to 26 years to life in state prison for Figueroa’s killing, along with a consecutive term of life plus six years for the attack on his former girlfriend.