UVALDE, Texas (AP) — Nearly 20 officers stood in a hallway outside of the classrooms during this week’s attack on a Texas elementary school for more than 45 minutes before agents used a master key to open a door and confront a gunman, authorities said Friday.

The on-site commander believed the gunman, 18-year-old Salvador Ramos, was barricaded in a classroom at Robb Elementary School in Uvalde during Tuesday’s attack and that the children were not at risk, Texas Department of Public Safety Director Steven McCraw said at a news conference.

“He was convinced at the time that there was no more threat to the children and that the subject was barricaded and that they had time to organize” to get into the classroom, McCraw said.

“Of course it was not the right decision. It was the wrong decision,” he said.

McCraw said U.S. Border Patrol agents eventually used a master key to open the locked door of the classroom where they confronted and killed Ramos, who killed 19 students and two teachers.

McCraw said there was a barrage of gunfire shortly after Ramos entered the classroom where they killed Ramos but that shots were “sporadic” for much of the 48 minutes while officers waited outside the hallway. He said investigators do not know if or how many children died during those 48 minutes.

Throughout the attack, teachers and children repeatedly called 911 asking for help, including a girl who pleaded: “Please send the police now,” McCraw said.

Questions have mounted over the amount of time it took officers to enter the school to confront the gunman.

It was 11:28 a.m. Tuesday when Ramos’ Ford pickup slammed into a ditch behind the low-slung Texas school and the driver jumped out carrying an AR-15-style rifle.

Twelve minutes after that, authorities say, the 18-year-old Ramos entered the halls of Robb Elementary School and found his way to a fourth-grade classroom, where he killed 19 students and two teachers in a still-unexplained spasm of violence.

But it wasn’t until 12:58 p.m. that law enforcement radio chatter said Ramos had been killed and the siege was over.

What happened in those 90 minutes, in a working-class neighborhood near the edge of the town of Uvalde, has fueled mounting public anger and scrutiny over law enforcement’s response to Tuesday’s rampage.

“They say they rushed in,” said Javier Cazares, whose fourth-grade daughter, Jacklyn Cazares, was killed in the attack, and who raced to the school as the massacre unfolded. “We didn’t see that.”

Friday’s update on the attack’s timeline came only after authorities declined to explain why officers had not been able to stop the shooter sooner, with Victor Escalon, regional director for the Texas Department of Public Safety, telling reporters Thursday that he had “taken all those questions into consideration,” but was not ready to answer them.

The Thursday briefing, called by Texas safety officials to clarify the timeline of the attack, provided bits of previously unknown information. But by the time it ended, it had added to the troubling questions surrounding the attack, including about the time it took police to reach the scene and confront the gunman, and the apparent failure to lock a school door he entered.

After two days of providing often conflicting information, investigators said that a school district police officer was not inside the school when Ramos arrived, and, contrary to their previous reports, the officer had not confronted Ramos outside the building.

Instead, they sketched out a timeline notable for unexplained delays by law enforcement.

After crashing his truck, Ramos fired on two people coming out of a nearby funeral home, Escalon said. He then entered the school ”unobstructed” through an apparently unlocked door at about 11:40 a.m.

But the first police officers did not arrive on the scene until 12 minutes after the crash and did not enter the school to pursue the shooter until four minutes after that. Inside, they were driven back by gunfire from Ramos and took cover, Escalon said.

The gunman was still inside at 12:10 p.m. when the first U.S. Marshals Service deputies arrived. They had raced to the school from nearly 70 miles (113 kilometers) away in the border town of Del Rio, the agency said in a tweet Friday.

The crisis came to an end after a group of Border Patrol tactical officers entered the school at 12:45 p.m., said Texas Department of Public Safety spokesperson Travis Considine. They engaged in a shootout with the gunman, who was holed up in the fourth-grade classroom. Moments before 1 p.m., he was dead.

Escalon said that during that time, the officers called for backup, negotiators and tactical teams, while evacuating students and teachers.

Ken Trump, president of the consulting firm National School Safety and Security Services, said the length of the timeline raised questions.

“Based on best practices, it’s very difficult to understand why there were any types of delays, particularly when you get into reports of 40 minutes and up of going in to neutralize that shooter,” he said.

Many other details of the case and the response remained murky. The motive for the massacre — the nation’s deadliest school shooting since Newtown, Connecticut, almost a decade ago — remained under investigation, with authorities saying Ramos had no known criminal or mental health history.

During the siege, frustrated onlookers urged police officers to charge into the school, according to witnesses.

“Go in there! Go in there!” women shouted at the officers soon after the attack began, said Juan Carranza, 24, who watched the scene from outside a house across the street.

Carranza said the officers should have entered the school sooner: “There were more of them. There was just one of him.”

Border Patrol Chief Raul Ortiz did not give a timeline but said repeatedly that the tactical officers from his agency who arrived at the school did not hesitate. He said they moved rapidly to enter the building, lining up in a “stack” behind an agent holding up a shield.

“What we wanted to make sure is to act quickly, act swiftly, and that’s exactly what those agents did,” Ortiz told Fox News.

But a law enforcement official said that once in the building, the agents had trouble breaching the classroom door and had to get a staff member to open the room with a key. The official spoke on condition of anonymity because he was not authorized to talk publicly about the investigation.

Department of Public Safety spokesman Lt. Christopher Olivarez told CNN that investigators were trying to establish whether the classroom was, in fact, locked or barricaded in some way.

Cazares said that when he arrived, he saw two officers outside the school and about five others escorting students out of the building. But 15 or 20 minutes passed before the arrival of officers with shields, equipped to confront the gunman, he said.

As more parents flocked to the school, he and others pressed police to act, Cazares said. He heard about four gunshots before he and the others were ordered back to a parking lot.

“A lot of us were arguing with the police, ‘You all need to go in there. You all need to do your jobs.’ Their response was, ‘We can’t do our jobs because you guys are interfering,’” Cazares said.

As for the armed school officer, he was driving nearby but was not on campus when Ramos crashed his truck, according to a law enforcement official who was not authorized to discuss the case and spoke of condition of anonymity.

Investigators have concluded that school officer was not positioned between the school and Ramos, leaving him unable to confront the shooter before he entered the building, the law enforcement official said.

Michael Dorn, executive director of Safe Havens International, which works to make schools safer, cautioned that it’s hard to get a clear understanding of the facts soon after a shooting.

“The information we have a couple of weeks after an event is usually quite different than what we get in the first day or two. And even that is usually quite inaccurate,” Dorn said. For catastrophic events, “you’re usually eight to 12 months out before you really have a decent picture.”