After a 19-year-old gunman fired at least eight rounds into a California synagogue, he stopped to fumble with his semiautomatic rifle and then fled with 50 unused bullets, prosecutors said Tuesday.

In his first court appearance, John T. Earnest pleaded not guilty to murder and attempted murder in the shooting that killed a worshipper and injured three others at the Chabad of Poway synagogue on the last day of Passover, a major Jewish holiday. He also pleaded not guilty to burning a mosque last month in nearby Escondido.

Earnest fired eight to 10 shots inside the synagogue near San Diego on Saturday, hitting Lori Kaye, 60, twice as she prayed in the foyer, prosecutors say. Rabbi Yisroel Goldstein lost an index finger.

Then Earnest turned toward a room of children and some adults, where Almog Peretz tried to protect his niece and other kids, prosecutors said. He and his niece Noya Dahan, 8, suffered shrapnel wounds.

It was unclear if the weapon jammed or malfunctioned or if the gunman didn't know how to reload.

"Something happened to interrupt his use of that gun," San Diego County District Attorney Summer Stephan told reporters.

He fled, and several people pursued him, including an off-duty Border Patrol agent who fired at him but missed, striking his getaway car, authorities said. Earnest called 911 after fleeing the synagogue and reported his location, prosecutors said. A police officer pulled him over and arrested him without a struggle.

Earnest legally purchased the gun, Stephan said, declining to elaborate. She said he wore a tactical vest and carried five loaded magazines with 10 bullets each.

David Chipman, a retired agent of the U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives, suggested the gunman might not have known what he was doing, and was unable to reload efficiently.

"I wish this was more common — that people fail," said Chipman, a senior policy analyst for the Giffords Center, an organization dedicated to fighting gun violence. "The reality is that with today's weapons, they are designed to not malfunction."

Earnest, wearing glasses and standing inside a glass cabin in court, showed no emotion as a prosecutor recounted Saturday's attack in Poway, a suburb north of San Diego. He spoke only once, acknowledging he was waiving his right to a speedy preliminary hearing, where prosecutors lay out their evidence.

Judge Joseph Brannigan denied bail and scheduled the hearing for July 8.

Earnest would be eligible for the death penalty or life in prison without parole if convicted of murder that is classified as a hate crime, said Stephan, who met earlier in the day with the victim's family. She said she would decide soon whether to seek the death penalty.

California Gov. Gavin Newsom in March issued a moratorium on executions while he is in office.

The district attorney, who vowed to avoid identifying the Earnest by name, said the defendant expressed his "intent to harm Jews" in an online posting. He also acknowledged using gasoline to spark a blaze that charred a wall of the Escondido mosque and scrawling graffiti praising the gunman who killed 50 people at two New Zealand mosques last month, Stephan said.

Earnest was an accomplished student, athlete and musician whose embrace of white supremacy and anti-Semitism stunned his family and others closest to him. He lived with his parents and made the dean's list both semesters last year as a nursing student at California State University, San Marcos.

Stephan said hate crimes are often preceded by hateful words.

"A whole world can come into the privacy of their bedroom and their families don't really see it," Stephan said, declining to discuss specifics of the case.

His father, John A. Earnest, is a popular physics teacher at the high school his son attended. The parents said their son and five siblings were raised in a family that "rejected hate and taught that love must be the motive for everything we do."

"To our great shame, he is now part of the history of evil that has been perpetrated on Jewish people for centuries," the parents said Monday in their first public comments. "Our son's actions were informed by people we do not know, and ideas we do not hold."

Earnest frequented 8chan, a dark corner of the web where those disaffected by mainstream social media sites often post extremist, racist and violent views.

"I've only been lurking here for a year and half, yet what I've learned here is priceless. It's been an honor," he wrote.

___

This story has been corrected to show the rabbi's first name was misspelled.