Robb Elementary had security. It didn’t stop a massacre.

Texas leaders strained to determine what went wrong after 19 students and two teachers died this week in the state’s latest mass shooting. But Republican Gov. Greg Abbott asserted the killer’s access to assault weapons wasn’t the problem.

Abbott and top officials are instead revisiting efforts to bolster mental health services and harden school security as families grieve the tragic attack at Robb Elementary School, renewing a debate that last rocked Texas when a 2018 high school massacre killed 10 people.

The state approved new laws in 2019 to arm more teachers, lock down schools and train for threats. The Uvalde Consolidated Independent School District, located in a predominantly Latino community between San Antonio and the southern border, had a robust security protocol that counted social media threat-monitoring software and a small campus police force among its defenses by the time of Tuesday’s nightmare.

Yet a school safety researcher and an advocate for superintendents said calls to flood schools with added security distract from the problem of preventing easy access to firearms wielded to kill children. And as Democrats rage in Washington, in Texas and across the country about a lack of federal action to enhance background checks with legislation already approved by one chamber of Congress, Abbott made clear restricting access to firearms is a non-starter in his state.

"Anybody who shoots somebody else has a mental health challenge, period," the governor said Wednesday after officials recounted new details surrounding this week’s horror inside Robb Elementary School.

“There are more people who were shot every weekend in Chicago than there are in schools in Texas,” he added. “We need to realize that people who think that, ‘well maybe if we could just implement tougher gun laws,’ is going to solve it — Chicago and L.A. and New York disprove that thesis.”

Authorities were still searching on Wednesday for a clear motive behind the shooting that left at least 17 people wounded in addition to the dead, and warned many details were still under investigation. The assailant, identified as 18-year-old Salvador Ramos, had no known criminal history and lived with his grandmother.

Ramos purchased two semi-automatic rifles at a local sporting goods store and 375 rounds of ammunition in the days before the killings, Texas Department of Public Safety Director Steven McCraw said.

Authorities said Ramos then shot his grandmother on Tuesday, drove her vehicle near Robb Elementary, crashed it and then approached a back door on the west side of the school with a backpack and one rifle.

On Wednesday, state officials initially said a school district resource officer approached the gunman and “engaged him,” but no gunfire was exchanged before the shooter entered two connected classrooms. Law enforcement officials abruptly reversed that account Thursday, saying no school police officer ever confronted the attacker when he jumped a fence surrounding the school, fired at the building, and entered the campus through what they said appeared to be an unlocked door.

“He walked in undisrupted initially,” Victor Escalon of the Texas Department of Public Safety said to reporters, adding that the gunman then fired at responding officers as they called for help.

It took approximately one hour, Escalon said, before members of an elite Border Patrol SWAT team arrived to lead an effort to breach the classroom and kill the gunman.

The shooting left Texas to assess the limits of recent efforts to expand school security and mental health services.

A flurry of laws signed onto the state’s books after 2018’s killings at Santa Fe High School were meant to increase mental health awareness and services for educators and students, require new threat assessments and allow schools to designate an unlimited number of employees who could carry firearms on school grounds.

“We're all going to go back and look at both exactly what was passed, any shortcoming in what was passed, [and] any shortcoming in implementation,” Abbott said of those laws.

Uvalde’s school district also supplemented its small police force with a range of security measures, according to school district documents.

The district said it had assigned a group of support counselors and threat assessment teams to each campus and that it used software known as Social Sentinel that monitored “all social media with a connection to Uvalde” to identify any possible threats. Robb Elementary was also one of a group of campuses that used perimeter fencing designed to limit access to the building, according to the school district.

By the time Ramos approached the school with one Daniel Defense-branded rifle loaded with ammunition, those measures were not enough to stop the deadliest school shooting in the U.S. since the 2012 slaughter at Sandy Hook Elementary in Newtown, Conn.

“The ability of an 18-year-old to buy a long gun has been in place in the state of Texas for more than 60 years,” Abbott said.

“Why is it that for the majority of those 60 years we did not have school shootings, and why is it that we do now?" he said. "What I do know is this: We as a state, we as a society, need to do a better job with mental health."

Students organized by a subsidiary of the Everytown for Gun Safety organization plan to walk out of schools across the country on Thursday, underscoring how demands to overhaul gun laws remain a potent part of the school shooting debate.

In the aftermath of the Sandy Hook shooting, AASA, The School Superintendents Association ranked among organizations that called for enforcement of existing gun laws, expanded background checks, plus bans on assault weapons and high-capacity magazines.

“The years have gone by, and they continue to go by, and not a damn thing is done. Nothing. And children are being killed,” said Daniel A. Domenech, the organization’s executive director.

“Who would have thought that parents would have to worry about sending their children to school? Or fear that their children would be shot and murdered in the classroom? That’s unbelievable,” he said.

Odis Johnson, executive director of the Johns Hopkins Center for Safe and Healthy Schools, said his group’s emerging research on school security suggests students at schools that rely on law enforcement or other surveillance for security have lower test score performance and college attendance rates when compared to students in other schools with similar characteristics.

“I would never want to push back on resources for mental health support,” Johnson said.

“But the other thing that has to be said is that the high prevalence of gun ownership in the U.S. makes it so much more likely here than in other countries that students or young people will be exposed to guns and have access to them. So, it's not just that everyone is healthy, because there's always going to be someone who may fall through the cracks.”

Michael Stratford contributed to this report