Street artist Mark Panzarino, 41, prepares a memorial at Union Square in New York in June 2013, six months after the massacre in Newtown, Conn. He writes the names of the Sandy Hook Elementary School victims. One of the enduring legacies of the school shooting is a widespread effort to improve school safety. (Eduardo Munoz/Reuters)

Coy Ferreira stood inside a rural California classroom, more than a dozen 5- and 6-year-olds huddled in the corner as a gunman sprayed bullets at the school and tried to break his way in. Ferreira was terrified that people would die.

But the doors were locked and all of the children were inside, part of a school plan the staff and students had practiced in drills and knew by heart. They barricaded the school in just 47 seconds that morning last month, probably saving the lives of countless people at Rancho Tehama Elementary School.

“They all knew what to do,” said Ferreira, who was dropping his daughter off at school when they heard a gunshot nearby. “No one stumbled. No one was hiding. They just ran to their classroom, like they had been told to do.”

The near-flawless response to what could have been a bloodbath during a deadly shooting rampage on Nov. 14 came almost exactly five years after 20 children and six teachers were killed at Sandy Hook Elementary School in Newtown, Conn. That attack, which involved a mentally unstable man using an assault-style rifle, shattered the sense of security felt in the nation’s elementary schools.

The massacre on Dec. 14, 2012, led to calls for gun control, as families mourned the loss of their innocent children. Five years later, little about the nation’s federal gun laws has changed. But the Newtown shooting forever altered the way American schools approach safety and assess risk, ushering in an era in which schools feel particularly vulnerable to the threat of shootings and students must know what to do in case one happens.

The result is that for America’s students, lockdowns like the one that helped save lives at Rancho Tehama Elementary and active-shooter training are now as commonplace as fire drills. Buzzers and locks have fortified school doors that were once left wide open. The sight of police officers, even in elementary schools, is now common. And some districts allow staff members to carry weapons at school for what they believe is an added layer of security.

“There was something about Sandy Hook,” said Telena Wright, superintendent of schools in Argyle, Tex., whose district has stepped up security measures since that shooting. “It was such a massacre that I think it captured the attention of school employees and school administrators and police officers that work in schools across the nation.”

One of those places was the Corning Union Elementary School District, which includes Rancho Tehama Elementary, an hour northwest of Chico in northern California.

“I have no doubt that the experience of Sandy Hook informed our response as a district, to any emergency event and to this one in particular,” said Superintendent Rick Fitzpatrick.

FBI agents are seen behind crime scene tape outside Rancho Tehama Elementary School after a shooting on Nov. 14, in Rancho Tehama, Calif. Several people were killed in a shooting rampage that day, but the elementary school — which had practiced active-shooter drills — successfully locked down as the shooter approached. Just one student was injured, and he is recovering. (Elijah Nouvelage/Agence France-Presse/Getty Images)

Era of lockdowns

The era of the school lockdowns started in 1999, after two students killed 13 people and themselves at Columbine High School in Littleton, Colo. High schools started drills where doors are locked and windows are secured — actions meant to be replicated should there be an emergency.

A gunman opens fire in your building. What do you do?

After the Newtown shooting, lockdowns became a regular part of school for younger children. So, in some places, did armed officers in elementary schools.

“There was a broader awareness that elementary and middle schools were at risk as well,” said Heidi Wysocki, a co-founder of Texas-based First Defense Solutions, which helps schools protect themselves and plan for shootings and other emergencies. “Nobody thinks somebody is going to murder 26 children and teachers, because it’s appalling. It’s just an unthinkable horror, and that wasn’t part of the conversation that was being had.”

Sandy Hook also created a new, controversial approach to school safety: the armed-assailant drill, when schools run a scenario involving a mass shooter, sometimes including police in the exercise. The practice has drawn scrutiny, some criticizing it as being potentially traumatizing for students, especially those in younger grades.

In Akron, Ohio, schools started active-shooter training around the time of the Sandy Hook attack. The shooting also spurred the district to retrofit some schools with secondary doors, buzzers and thick glass.

The district now runs active-shooter drills four times a year, drills that are tailored to each age group, said Dan Rambler, the district’s director of student support services and security. Parents are invited to watch training videos and give input.

In younger grades, the issue is addressed as one of stranger danger. But children, he said, often know what is happening: Rambler’s son was in kindergarten during one of the first training sessions and told his father that while it focused on bad people, “there are people who go to schools and shoot people,” Rambler remembers the boy saying.

Jeff Fritz, superintendent of schools in Clay County, Ind., said that when he started his career as an educator 35 years ago, the “doors were wide open” at the school where he worked. No more.

The county’s 4,000 students now drill for an active shooter. Fritz said students are taught to run, hide or fight — with fighting being the very last option.

“It’s no different than we do with tornado drills or fire drills,” he said. “This has been in the forefront. I tell our staff and our students our number one priority, above test scores or building projects . . . is school safety.”

Some states and districts are allowing staff members to carry weapons at schools. At least eight states allow concealed-carry permit holders to have a firearm at a K-12 school, according to the Giffords Law Center to Prevent Gun Violence.

In Argyle, Tex., signs outside schools say staffers are armed and "may use whatever force is necessary to protect our students." It was a decision, Wright said, that stemmed directly from Sandy Hook.

When officials in the Briggsdale School District in rural Colorado heard about the shooting at Sandy Hook, they kept thinking about the time it would take police to respond to their schools. In their remote area of northern Colorado, emergency response was likely to take a minimum of 25 minutes.

Now there are staff members who carry concealed guns and have been trained to act as security guards if needed. Their identities are secret. Superintendent Rick Mondt said response from parents has been positive: They feel better with the school not being a soft target.

“We’ve had parents who brought their kids here because of this,” he said.

Flowers and candles are left as a memorial in front of St. Rose of Lima Catholic Church in Newtown, Conn., on Dec. 15, 2012, days after the massacre at Sandy Hook Elementary School left 20 children and six school employees dead. (Andrew Lichtenstein/For The Washington Post)

Channeling grief

Some of the parents of the children killed in Newtown have channeled their grief into making schools safer.

Michele Gay and Alissa Parker co-founded Safe and Sound Schools, which looks to improve school safety through training, discussion and partnerships. They both lost daughters at Sandy Hook; Gay's 7-year-old, Josephine, and Parker's 6-year-old, Emilie. Gay said there has been a profound shift in the way schools think about safety and plan for the worst, with parents and students now heavily involved, and much greater collaboration between different agencies and groups.

Mark Barden, whose 7-year-old son Daniel was killed, co-founded Sandy Hook Promise with Nicole Hockley, who lost her son, Dylan. The organization is working in all 50 states with schools and other organizations to teach the warning signs often exhibited by potentially violent people both in person and on social media.

Barden said the past five years have been “indescribably difficult and challenging.” He said he is honoring Daniel’s memory by making schools safer and saving lives.

“Hopefully, if we have this conversation in five or 10 years, we’re not going to need to be training our kids with how to deal with an active shooter,” he said.

In May 2013, Mark Barden looks out the window and weeps while talking about his 7-year-old son, Daniel, who was killed in the Sandy Hook Elementary School massacre in 2012. (Linda Davidson/The Washington Post)

But school shootings continue unabated. Beginning with Columbine 18 years ago, more than 135,000 students attending at least 164 primary or secondary schools have experienced a shooting on campus as of April 2017, according to a Washington Post analysis of online archives, state enrollment figures and news stories. That doesn’t count dozens of suicides, accidents and after-school assaults that have also exposed children to gunfire.

There have been at least three shootings at K-12 schools this school year. In September, a 15-year-old student in Rockford, Wash., killed one student and injured three others; that same month, a 14-year-old student shot and wounded a classmate in Mattoon, Ill. Two students were killed Thursday in a high school shooting in Aztec, N.M., after a 21-year-old local resident entered the school pretending to be a student and carried out what authorities said was a planned attack with a legally purchased Glock handgun; the gunman also died.

“We obviously do drills and hope that nothing ever happens,” said Aztec Municipal School Superintendent Kirk M. Carpenter. “Our staff and even our substitutes reacted in a way that saved a lot of lives.”

Students are led out of Aztec High School after a shooting there left two students dead on Dec. 7, in Aztec, N.M. (Jon Austria/AP)

Drills and good fortune

At Rancho Tehama Elementary, officials credit their drills, quick action by staff and parents and a measure of good fortune for ensuring that no one was killed in the November attack.

Ferreira and his 5-year-old daughter were standing outside before school, when they heard a pop. He thought it was a firecracker. But it was loud enough that some children dropped to the ground.

When the school secretary heard two more bangs, she announced a lockdown.

A teacher called for everyone to get inside. Ferreira heard a crash, as the gunman’s truck smashed into the elementary school’s gates. He told his daughter to run and urged other children to get inside.

Alejandro Hernandez, a student at Rancho Tehama Elementary School, who was shot twice when a man tried to attack the school in November. (Courtesy of Angelica Monroy)

Everyone quickly made it into classrooms, except for one little girl who was across the playground, too scared to move. Ferreira ran to her, scooped her up and ran her inside. He looked out the window, and the teacher told him to move away.

The blinds fell back into place as he stepped back, and bullets began smashing through them.

The children didn’t move or make a sound. Just as they had practiced.

Ferreira thought about Sandy Hook and the teachers who died to protect children. He thought maybe he could use the fire extinguisher as a weapon if the shooter got through the door.

But the door was locked. The children had gotten inside. Two little boys were hiding under desks. One of them, Alejandro Hernandez, was bleeding; he was hit once in the foot and once in the lung by bullets that went through the wall.

Alejandro didn’t cry. Only later did he tell Ferreira, “I want to be with my mommy.”

The gunman left the school, unable to get in. Law enforcement officers took over, and Alejandro was taken to the hospital. He is back home now, too scared to go back to his classroom, unwilling to talk about the shooting, but recovering well enough to no longer need painkillers for his wounds. His mother, Angelica Monroy, is grateful the school locked down so quickly.

“I really . . . ” she said, struggling to compose herself. “I thank them so much for everything.”

In those few seconds that day, the children followed the drill they had practiced. The adults knew what to do.

If not for the lessons of Sandy Hook, if not for their plan, if it had all been like any other Tuesday morning, parents and school officials shudder to think what might have befallen Rancho Tehama.

“He would have caught us all outside,” Ferreira said. “He would have had free range.”

One of the bullet holes seen in an exterior wall at the Rancho Tehama Elementary School. (Rich Pedroncelli/AP)

Moriah Balingit, Jennifer Jenkins and John Woodrow Cox contributed to this report.