A 34-year-old man who was wounded when gunfire erupted inside a San Diego-area synagogue on Saturday was being praised as a hero for saving several children from a hail of bullets.

The gunman – identified by authorities as 19-year-old John Earnest – allegedly opened fire with an assault-type rifle inside the Chabad of Poway synagogue as worshippers were preparing to celebrate the last day of Passover. A woman was killed and three people were injured.

“[The gunman] was just shooting, shooting, shooting, shooting. Like crazy. Just spraying,” said Danny Almog, whose friend Almog Peretz was shot in a leg while leading children to safety, FOX 5 San Diego reported.

“(The gunman) was just shooting, shooting, shooting, shooting. Like crazy. Just spraying.” — Danny Almog

POLITICIANS REACT TO CALIFORNIA SYNAGOGUE SHOOTING: 'NO ONE SHOULD EVER FEAR GOING TO THEIR PLACE OF WORSHIP'

Witnesses said Peretz grabbed children during the gunfire and ran with them to nearby exits.

“He grabbed all the kids in his hands and was just running towards the exit (when) he saw another kid over there," Almog told the news station. "He grabbed him and started running and (that's when) the shooter shot him in the leg. He didn’t care. He kept on running with the kids and just ran out.”

Peretz was recovering in a hospital Saturday night, along with a rabbi who was shot in a hand and a young girl struck by gunfire. They are all expected to survive. Lori Kaye, 60, died from her injuries.

CLICK HERE TO GET THE FOX NEWS APP

A Border Patrol agent inside the synagogue fired at Earnest, missing him, but struck his getaway vehicle. Earnest called 911 after the shooting and identified himself as the shooter, authorities said.

Authorities said Earnest had posted an anti-Jewish screed online and was being investigated in connection with an arson that caused damage to a mosque in nearby Escondido last month. No injuries were reported in that fire.

Saturday's shooting is being investigated as a possible hate crime.