When family members of 19-year-old Orlando Harris grew concerned about his mental health, they seemed to do everything right, the St. Louis police commissioner said.
"They contacted us, said that he had a firearm," Commissioner Michael Sack said Wednesday.
"The mother at the time wanted it out of the house," he said. "The officers, in their response, handed it over to somebody else, an adult who was lawfully able to possess it."
At times, the teen's family also committed him to a mental institution, Sack said.
RELATED: What we know about the teacher, student killed in St. Louis school shooting
Yet somehow, Harris managed to get access to an AR-15-style rifle and 600 rounds of ammo. And on Monday, he took his deadly arsenal to Central Visual and Performing Arts High School and wreaked terror on his alma mater.
By the end of the rampage, a talented student and a heroic teacher were dead. Harris was killed by officers.
And community members are stunned as to why the proactive interventions described by police didn't seem to work.
In addition to removing Harris' firearm from the house and getting mental health treatment for the teen, the gunman's family took additional steps to help prevent trouble, CNN reported.
"They would search his room on occasion because they were concerned," the police commissioner said. "They were constantly in touch with the medical providers who were providing medical care for him."
Harris' family also had a system to track the items he received in the mail and monitored his interactions with others to try to ensure he was engaging with people and felt loved, Sack said.
"I've got to give credit to the family," the police chief said. "They made every effort that they felt that they reasonably could. And I think that's why the mother is so heartbroken over the families that paid for his episode."
After the gunman forced his way into the school and opened fire, investigators found a notebook and a handwritten note left in the car he drove, Sack said.
"I don't have any friends. I don't have any family. I've never had a girlfriend. I've never had a social life. I've been an isolated loner my entire life," the note said, according to Sack. "This was the perfect storm for a mass shooter."
The notebook also revealed Harris seemed to feel a disconnect with the school community and had targeted his former high school, Sack said.
The gunman also wrote that his family didn't know about his plans, Sack said. The police chief said the family never had access to the notebook.
"Mental health is a difficult thing. It's hard to tell when somebody who's going to be violent, or act out, or if they're just struggling, they're depressed and they might self-harm," the police commissioner said.
"It's just a terrible thing, and it's hard to try and figure out what might have been in somebody's mind."
After the gunman burst into the school, a school official got on the intercom an urgent, coded message: "Miles Davis is in the building."
It was a signal only heard during active shooter drills. But this time, it was real.
Teacher Kristie Faulstich heard the phrase and locked her classroom door.
Less than a minute later, someone started "violently jostling the handle, trying to get in," Faulstich said.
Alex Macias' health teacher, Jean Kuczka, also locked her classroom door, the student told CNN affiliate KSDK.
But the gunman managed to "shoot his way in," Alex said.
"He did shoot Mrs. Kuczka, and I just closed my eyes," Alex said. "I didn't really want to see anything else. But then as I thought he was leaving, I opened my eyes to see him standing there making eye contact with me.
"And then after he made eye contact, he just left."
Students started jumping from the windows to escape, Alex recalled.
But her health teacher, Kuczka, was killed. The 61-year-old died trying to shield her students from the gunman, Faulstich said.
A student, 15-year-old Alexandria Bell, was also killed. The avid dancer was less than a month away from celebrating her Sweet 16.
The school's Dean of Arts Manfret McGhee ran for his life after a bullet missed him in a hallway, he told KSDK.
He hid in a bathroom, not knowing his own 16-year-old son had been shot. Then he ran to his son's health class.
"When I first saw him, I saw a massive hole in his pant leg, and all I could think of was, 'My God, what did he get shot with?'" he said.
McGhee used his belt to stop the bleeding.
The gunman was wearing a chest rig with seven magazines of ammunition, the police commissioner said. He also carried more ammunition in a bag and dumped additional magazines on the stairway and in the corridors along the way.
"It doesn't take long to burn through a magazine as you're looking at a long corridor or up or down a stairwell or into a classroom," Sack said.
The police commissioner has credited a quick police response, locked doors and prior training for preventing more deaths.
"It was not by the grace of God and that the officers were as close as they were and responded in the manner that they did," Sack said.
Seven security personnel were also at the school when the gunman arrived, but the shooter did not enter through a checkpoint where security guards were stationed, said DeAndre Davis, director of safety and security for Saint Louis Public Schools.
The security guards stationed in the district's schools are not armed, Davis said, but mobile officers who respond to calls at schools are.
The mass shooting raised questions about whether it would have made a difference if the first person to confront the gunman was also armed.
Matt Davis, the president of the St. Louis public school board, had a blunt answer: "The assailant had a high-powered rifle -- so much so that he could force himself into a secured building. The building is riddled with bullets."
"I don't know how much firepower it would take to stop that person. You saw the police response, it was massive. It was overwhelming," Davis said.
"I know what would have been different is if this high-powered rifle was not available to this individual. That would have made the difference."
The St. Louis tragedy follows a long spate of school shootings committed by teenagers using AR-15-style rifles -- including those in Uvalde, Texas; Parkland, Florida; and Newtown, Connecticut.
"The fact that it takes this level of response to stop a shooting like this because people have access to these weapons of war and can bring them into our schools can never be normal," Davis said.
"This is our worst nightmare. ... And it can't happen again."
The Saint Louis Public Schools district is planning to add gun safety to its curriculum, Superintendent Dr. Kelvin Adams said.
"Not just reading, writing, and arithmetic, but reading, writing, arithmetic and gun safety," he said.
Adams said helping students understand how dangerous guns can be will help protect them in school, in their neighborhoods, and "quite frankly, everywhere now."