The Uvalde massacre began after the 18-year-old gunman entered the school through a door that could only be locked from the outside and then got inside a classroom that had a busted lock, experts testified Tuesday.

Securing doors has long been a focus of school safety drills, and the inability to do so during the May 24 attack that left 19 children and two teachers dead is raising alarms among experts and politicians.

When doors are not secure, “your first step, your first line of defense has now been eliminated, has been taken away from you really,” said Ken Trump, the president of the National School Safety and Security Services.

State Sen. Paul Bettencourt said unlockable doors make lockdowns and shooter training worthless, adding that there was “zero obstacle to the shooter.”

Questions about how the shooter entered Robb Elementary and what happened at multiple doors have been a big part of the changing information about the attack.

WHAT HAPPENED WHEN THE GUNMAN REACHED THE OUTSIDE DOOR?

State police initially said the gunman entered the school through an exterior door that had been propped open by a teacher.

Days later, state police retracted that statement to make it clear that the teacher closed the door. But somehow it didn’t lock.

Nearly a month after the rampage, Col. Steve McCraw, director of the Texas Department of Public Safety, further amended what his agency’s investigation shows: The teacher did close the door, but unbeknownst to her, it could be locked only from the outside.

The gunman “walked straight through,” McCraw said Tuesday in blistering testimony at a state Senate hearing in Austin.

Ronald Stephens, executive director of the National School Safety Center, said he was “astonished” that the exterior door could only be locked from the outside.

“I’m trying to think if I’ve even ever seen that. It’s so rare that that would be the case. Why wouldn’t there be an opportunity to lock it from the inside?”

He likened it to a house that could only be locked from the outside.

“Shouldn’t the security of the school be as safe as the security of your home?” he asked. “To only be able to lock from the outside is just totally unacceptable in my view.”Experts did not explain during the hearing why the school’s exterior door locked from outside. Robb Elementary is an older building, constructed in 1955.

WHAT HAPPENED WHEN THE GUNMAN REACHED THE CLASSROOM DOOR?

Once inside the school, the shooter then entered a classroom with a door could not be locked from the inside by design, according to McCraw, who also said a teacher reported before the shooting that the lock was broken.

“This is ridiculous and it’s inexcusable,” McCraw said of the fact that the classroom door could not be locked from the inside.

Stephens and Trump also raised alarms about the fact that the door was broken, describing it as a maintenance issue.

“That’s about how you manage and maintain school property in a responsible way,” Stephens said.

McCraw also disclosed Tuesday that despite the fact that the door was unlocked, there is no indication officers tried to open it during the standoff. He said police instead waited around for a key.

Stephens said the way the situation played out spoke to the broader need of having a crisis plan in place.

“To me, there’s just a whole cascade of apparent failures that took place in this particular situation,” he said. “It’s a wake-up call to everyone across America.”

HAVE THERE BEEN PROBLEMS BEFORE?

At Sandy Hook Elementary School, the doors of the two classrooms where all 20 children were killed in the 2012 massacre, along with their teachers, could only be locked from the hallway with a key.

Some victims’ families have said lives could have been saved if teachers were able to lock classroom doors from the inside, and they questioned whether two teachers who were killed in the shooting, Victoria Soto and Lauren Rousseau, even had access to keys.

Another teacher who could not get a classroom door locked told investigators that she looked into the hallways, saw a janitor who yelled at the gunman to leave and motioned to the janitor to lock her door.

Sandy Hook Elementary was also built in 1955.

WHAT STEPS ARE RECOMMENDED?

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

Teachers and students drill for how to respond.

“Lock the door, turn off the light. Get the kids and staff into a hard corner, meaning not in the direct line of sight of the window where somebody can shoot through, and be quiet,” Trump said.

He said those actions can “absolutely” save lives.

Exterior doors “keep the threat out of the building. Your next layer inside are your locked doors to your classrooms, officers and work areas. All of these layers are intended to buy time,” he said.

He said shooters’ adrenaline is going and they know that — in most cases — their time is limited.

“They’re not going to spend a ton of time trying to get in a locked door where they may or may not know if somebody’s inside, if the kids are quiet and out of sight. They’re going to continue to move on to where they have a more accessible target.”