Doors – both the one the gunman entered and the one police did not open for over an hour – have been at the center of the investigation into the killing of 19 students and two teachers in Uvalde, Texas, and the police response to the massacre.

Click here to subscribe to WAVY’s breaking news email alerts

School officials under pressure to balance accessibility and safety confront a variety of decisions about the seemingly mundane act of going in and out of a building or classroom. But as the attack on Robb Elementary School showed, such choices can sometimes spell the difference between life and death.

State police initially said the gunman entered through an exterior door that had been propped open by a teacher. But a spokesman for the Texas Department of Public Safety said Tuesday that the teacher closed the door after realizing a shooter was on campus, but it did not lock as it should have.

Inside the school, officers waited for more than an hour to breach the classroom, and state authorities have blamed the head of the school district’s small police department for wrongly believing children were no longer at risk. Officials said a U.S. Border Patrol tactical team used a janitor’s key to unlock the classroom door and kill the gunman.

State and federal panels charged with reviewing individual mass shootings have repeatedly advised limiting access to school buildings by locking exterior doors, forcing visitors to enter through a secure door and requiring teachers to lock classrooms while classes are in session.

The U.S. Cybersecurity and Infrastructure Security Agency tells districts that they may be able to delay an intruder by keeping exterior doors locked when they are not being monitored by staff. But schools will still need to ensure that employees “adhere to policies mandating that all exterior doors remain closed outside of student arrival and dismissal times.”

In its latest guidance, updated in February, the agency also wrote that districts should consider whether measures such as automatic locks on classroom doors could hinder emergency responders.

“If a school installs automatic locks on classroom doors, they should provide emergency responders with a means of accessing all locked down areas; the office might therefore place master keys or key fobs in a safe but easily accessible location, or provide local authorities with a copy of these devices when first installing any new lock systems.”

But there are no federal standards or requirements on these points, leaving the decision up to state or local authorities. Those officials must also balance how to keep people safe in case of a fire or natural disaster and the expense of renovating and maintaining schools.

Each killing at a U.S. school increases pressure on school authorities to act, nudged on by security companies claiming new products will “harden” schools and prevent the next tragedy.

“I’ve had people suggest bulletproof glass everywhere or gunshot-detection systems, and it’s like ‘How far do you go?’” said Ronald Stephens, director of the National School Safety Center. “Would you rather have your resources invested in a great teacher or a school that looks like Fort Knox?”

After the 2018 shooting that left 10 dead at Santa Fe High School outside Houston, Texas lawmakers approved $100 million for school campus “hardening” projects.

According to a governor’s school safety report in 2019, that money could be used on older buildings for metal detectors, vehicle barriers, alarm systems, security fences, bullet-resistant glass, door-locking systems and other measures.

A state-run survey taken during the 2015 school year reported that 96.1% of administrators reported locking campus doors to limit access to the school. Almost 88% of districts used cameras and 79% had a sign-in process for visitors.

It’s not clear if Uvalde schools sought or received any of that money before last week’s shooting. A Uvalde school district spokesperson declined to answer emailed questions about school security.

It’s also unclear why it took so long for police to retrieve a key from a school official that allowed a U.S. Border Patrol tactical team to finally get inside the classroom.

Stephens said ensuring that law enforcement can get into locked classrooms is a crucial part of a school safety plan. He encourages schools to designate that responsibility to multiple people.

Security experts warn that physical barriers can only do so much. Human error, faulty equipment or an attacker’s determination can overcome security measures.

Locked doors certainly aren’t insurmountable. The gunman who killed 20 children and six adults in 2012 at Sandy Hook Elementary School in Newtown, Connecticut, shot out a window next to the school’s locked entrance doors and opened fire again once he entered.

Most research backs a more comprehensive approach focused on training educators to spot warning signs in at-risk kids paired with a rigorous safety plan, training for all staff and partnership with law enforcement and other community groups.

Chuck Wilson is the co-founder of the Partner Alliance for Safer Schools, a collection of security-focused companies and other school-safety advocates that developed their own set of guidelines for schools. They recommend schools “at a minimum” lock exterior doors while classrooms are in session and lock classroom doors too.

“It’s a lot less convenient, but it’s a lot safer in today’s world,” Wilson said. People who are intent on harming others, “they are creative. They have a lot of time to think, to watch, to observe the ingress and egress, the class changes, before school and after school activities.”