During the shooting at a Texas elementary school this week, nearly 20 officers stood in the hallway outside of classrooms for more than 45 minutes before breaching them.

Now officials are looking at the aftermath and saying they made the wrong choice.

Texas Department of Public Safety Director Steven McCraw said at a news conference that the on-site commander believed the gunman was barricaded in a classroom during Tuesday's attack, and believed the children were not at risk.

"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 the gunman.

Authorities say children repeatedly called 911 from inside the school where the gunman killed 19 students and two teachers, including a girl who told the dispatcher "Please send the police now."