ST. LOUIS (AP) — The 19-year-old gunman who forced his way into a St. Louis school and killed two people purchased the AR-15-style rifle from a private seller after an FBI background check stopped him from buying a weapon from a licensed dealer, St. Louis police said Thursday.

Orlando Harris tried to buy a firearm from a licensed dealer in nearby St. Charles, Missouri, on Oct. 8, police said in a news release Thursday evening. An FBI background check “successfully blocked this sale,” police said, though they didn’t say why the sale was blocked. A message seeking comment wasn’t immediately returned.

Harris then bought the rifle used in the school shooting on Monday at Central Visual and Performing Arts High School from a private seller who had purchased it legally in 2020, police said.

Police noted in the release that Missouri does not have a red-flag law aimed at keeping firearms away from people who may be a danger to themselves or others. As a result, police “did not have clear authority to temporarily seize the rifle when they responded to the suspect’s home when called by the suspect’s mother on 10/15/22.”

Police on Wednesday said Harris’ mother called police on the evening of Oct. 15 after she found a gun and wanted it removed. The statement said someone known to the family was contacted and took possession of it.

Somehow, Harris got the gun back. How that happened is under investigation.

Police responded within minutes after being called Monday morning. Officers confronted and killed the gunman, who graduated from the school last year. He had around 600 rounds of ammunition with him.

Tenth-grader Alexzandria Bell and teacher Jean Kuczka were killed in the attack, and seven 15- and 16-year-olds were wounded. None of the injuries are believed to be life-threatening.

Police believe Harris had intended targets. They have not said if any of the victims were among them.

Harris’ mother was “heartbroken” by the shooting, Police Commissioner Michael Sack said. She and other relatives had long dealt with Harris’ mental health issues and even had him committed at times, Sack said at a news conference on Wednesday. They also monitored his mail and often checked his room to make sure he did not have a weapon.

In a note left behind, Harris lamented that he had no friends, no family, no girlfriend and a life of isolation. His note called it the “perfect storm for a mass shooter.”

“Mental health is a difficult thing,” Sack said. “It’s hard to tell when somebody is going to be violent and act out, or if they’re just struggling, they’re depressed, and they might self-harm.”

Central Visual and Performing Arts shares a building with another magnet school, Collegiate School of Medicine and Bioscience, which also was evacuated as the shooting unfolded. Central has 383 students, Collegiate 336.

The building was locked Monday morning and an unarmed security guard saw Harris trying to get in. Sack has declined to say how Harris forced his way inside.

Officers, some of whom were off-duty, arrived four minutes after the 911 call. Amid the chaos of students, teachers and staff fleeing, officers asked some of them where the gunman was. Eight minutes after arriving, officers located Harris on the third floor, barricaded in a classroom. Police said that when Harris shot at officers, they shot back and broke through the door.

The St. Louis shooting was the first school shooting to involve multiple deaths since a gunman killed 19 children and two teachers at Robb Elementary School in Uvalde, Texas, in May, according to a list of shootings compiled by Education Week.