A 9-year-old student also was critically wounded. He and the boy who died were behind their special-education teacher, Elaine Smith, 53, the target of the man she had married months earlier, police said.
We believe this to be a murder suicide. Happened in a class room. Two students have been transported to the hospital.— Chief Jarrod Burguan (@SBPDChief) April 10, 2017
The shooting left hundreds of distraught parents waiting for hours to reunite with their children.
Staffers knew Cedric Anderson, who had been estranged from his wife for about a month, and he got into the school by saying he had to drop something off for Smith, officials said.
"No one has come forward to say they saw this coming," police Chief Jarrod Burguan told reporters.
Photos: Shooting at elementary school in San Bernardino, California
Anderson had a history of weapons, domestic violence and possible drug charges that predated the short marriage, authorities said.
He frequently wrote social media posts about his wife over the past month. On what appeared to be his Facebook page, Anderson said he "loved being married to Karen Smith-Anderson!" and posted a photo of the two of them on March 4 in what he described as a date night. He posted several photos of his wedding to Smith early this year and their honeymoon in Sedona, Arizona.
Fifteen students ranging from first to fourth grade were in the special-education classroom at North Park Elementary School, along with two adult aides and Smith, when Anderson emptied a large-caliber revolver and reloaded. Then, he turned the gun on himself.
Jonathan Martinez, the 8-year-old, was airlifted to a hospital and died soon after arriving, Burguan said. The 9-year-old boy, whose name was not released, has been stabilized at a hospital.
The 600 other students at the school were bused to safety at California State University's San Bernardino campus, several miles away, after many walked off campus hand-in-hand, escorted by police.
Panicked parents had to wait hours before being reunited with them at a nearby high school.
Holly Penalber, whose 9-year-old son and 7-year-old daughter attend the school, called it "every parent's worst nightmare." She said the long wait was "frustrating but also understandable."
When the buses first pulled away from the elementary school, 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.
When students got to the high school, many carrying glow sticks they had been given to pass the time, they got hugs from emotional parents, many in tears. Police officers applauded and high-fived them.
Alberta Terrell said she cried with relief when she was told that a family friend saw her 9-year-old granddaughter 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, waiting for her granddaughter to arrive.
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.
"Tragedy has again befallen our city," Police Lt. Mike Madden said Monday of a community that has struggled in recent years.
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 crime, particularly homicides, began to rise.
In the past year, however, the city seemed to be making a recovery. Burguan, who won national praise for the way his department responded to the 2015 attack, announced last year he was hiring additional officers.