The Uvalde school district had an extensive safety plan. 19 children were killed anyway.

Even security plans that appear to be up to the latest research-based standards may have gaps and fall short of preventing the worst-case scenario, experts said.

Prayer vigil held for Uvalde elementary school shooting victims

UVALDE, Texas – School officials in Uvalde, Texas, promised to do everything they could to protect students from a mass shooting.

Uvalde Consolidated Independent School District had doubled its security budget in recent years, according to public documents, in part to comply with state legislation passed in the wake of a 2018 school shooting in which eight students and two teachers were killed. The district adopted an array of security measures that included its own police force, threat assessment teams at each school, a threat reporting system, social media monitoring software, fences around schools and a requirement that teachers lock their classroom doors, according to the security plan posted on the district’s website.

It happened anyway.

Read more on NBC News here.