SAN BERNARDINO, CA - APRIL 10: Police offers stand guard at North Park Elementary School following a shooting on campus on April 10, 2017 in San Bernardino, California. Two people died, including the suspected shooter, and two children were wounded in the apparent murder-suicide attack. (Photo by David McNew/Getty Images)

SAN BERNARDINO, Calif. (AP) — A teacher and a student were shot to death and a second student critically wounded Monday in a murder-suicide at a San Bernardino elementary school that spread panic across a city still recovering emotionally from a terrorist attack at a community center just 15 months ago.

The suspected shooter who opened fired in a classroom at North Park School also died. A school official said the attack was believed to stem from a “domestic dispute” and that the teacher knew the gunman.

Two wounded students were flown to a hospital where an 8-year-old later died. The other student was listed in critical condition.

“The children we do not believe were targeted,” police Capt. Ron Maass told reporters.

The 600 other students at the school were bused to safety at California State University’s San Bernardino campus, several miles away. Television news footage showed students, escorted by police officers, walking off campus hand-in-hand.

As word of the shooting spread, panicked parents raced to the school, some in tears, some praying as they anxiously sought information about their children. They were told to go to a nearby high school where they would be reunited.

Four hours later, the children began to arrive at the high school, getting hugs from emotional parents. As the students got off the buses, many of them carrying glow sticks they had been given to pass the time with, police officers applauded and high-fived them.

When the buses first pulled away, some parents ran alongside, waving and trying to recognize their children inside. Many said their children were too young to have cellphones. Others said the phones rang unanswered.

Among those waiting anxiously at the high school for her 9-year-old granddaughter’s return was Alberta Terrell, who said she cried with relief when she was told that a family friend saw the girl getting safely onto a bus.

“I was really elated. But I won’t be truly happy until I see her and can give her a big hug,” Terrell said as she sat in the bleachers near Cajon High School’s baseball diamond.

“It’s frustrating for us as parents but also understandable,” Holly Penalber said of the long wait, which most parents seemed resigned to.

Penalber’s 9-year-old son and 7-year-old daughter attend the school. She called Monday’s shootings “every parent’s worst nightmare.”

San Bernardino, a city of 216,000 people about 60 miles east of Los Angeles, was the site of a December 2015 terror attack that killed 14 people and wounded 22 others at a meeting of San Bernardino County employees. Husband-and-wife shooters Syed Rizwan Farook and Tashfeen Malik were later killed in a gunbattle with authorities.

Monday’s shooting was the latest tragedy for a city that has struggled in recent years with more than its share of them. Once a major rail hub and citrus producer, San Bernardino filed for bankruptcy in 2012 after struggling to pay its employees despite steep cuts to the budget.

An outlying suburb of Los Angeles, it was hit hard when the Great Recession sent housing prices tumbling. As the city struggled with economic problems that forced layoffs of police and other government workers, violent crimes, particularly homicide, began to rise.

In the past year, however, the city seemed to be making a recovery. Police Chief Jarrod Burguan, who won national praise for the way his department responded to the 2015 shootings, announced last year he was hiring additional officers.

(© Copyright 2017 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)