When reports of a shooter spread on the campus of the University of North Carolina at Charlotte on Tuesday, the university’s emergency officials blasted out a stark, but increasingly familiar message: "Run, hide, fight."

Some students reported doing just that. One student, in a study hall at a library, said she and others barricaded the door with a table and stayed quiet, waiting for police. Another hid in a men's restroom, and a student who was in the classroom where the shooting broke out followed others who fled.

Student Riley Howell, without the option of running or hiding, confronted the suspected gunman, Trystan Andrew Terrell, 22, and "took the assailant off his feet," the Charlotte police chief said. That act saved lives, the chief said, but Howell was killed. In total, two people were killed and four others were wounded in the attack and police have yet to release a motive for the shooting.

The guidance to respond to active shooter situations by fleeing, hiding, or in a last resort taking action against a gunman began being used after the 2007 mass shooting at Virginia Tech, in which a gunman killed 32 people before killing himself, and it has become standard advice, experts said.

In 2012, the city of Houston released a training video titled "Run. Hide. Fight." funded through a Department of Homeland Security grant and that has been adopted by it and other federal agencies.

"It's simple, it's easy to repeat, it resonates," said Randy Burba, chief of public safety at Chapman University in Orange, California, and past president of the International Association of Campus Law Enforcement Administrators. He likened it to the instructions given on airplanes about what to do if there is a loss of cabin pressure and the oxygen masks drop.

"We don't want you to walk around worrying about a shooting," Burba said. "... But if it happens, a little bit of training and muscle memory is useful."

Charlotte-Mecklenburg Police Chief Kerr Putney said Wednesday that Howell, a 21-year-old environmental studies major, was a hero who "did exactly what we train people to do" and that he "took the assailant off his feet."

"You're either going to run, you're going to hide and shield, or you’re going to take the fight to the assailant," Putney said at a news conference. "Having no place to run and hide, he did the last. But for his work, the assailant may not have been disarmed. Unfortunately, he gave his life in the process, but his sacrifice saved lives."

Fighting an assailant is a last resort, Burba said. People in active shooter situations are urged to run from the danger but if they are unable to do that, they are told to hide. That can involve locking the door to rooms, turning off the lights to make it appear as though no one is inside, and using furniture to barricade doors, he said.

Even if the door opens out, stacking furniture can create impediments to a shooter. "Even if they get the door open, now they’ve got all these obstacles," Burba said.

The UNC Charlotte campus went on lockdown during the shooting, and students studying in the library described hearing an announcement on the intercom and people coming into the building yelling about a shooter.

One student who was in a library study room told NBC affiliate WCNC of Charlotte on Tuesday that they barricaded themselves in the room by putting a table against the door.

Eventually, a police officer entered the library and told students inside to leave "and we all grabbed our stuff and ran out," she said.

Another student, Jordan Pearce, 19, was also in the library and grabbed another girl, and the two hid in a men’s restroom until police arrived and escorted them out.

Students lay candles and flowers at the steps of Kennedy Hall to honor the victims of a shooting the day earlier on the University of North Carolina, Charlotte, North Carolina on May 1, 2019. Logan Cyrus / AFP - Getty Images

Some students as young as Pearce are not strangers to active shooter training; they grew up participating in active shooter drills. She said Wednesday that she had training in high school, and UNC Charlotte had also talked to students about it, telling them to run, hide or fight and to stay away from windows.

But she said her reaction "was also a gut instinct."

Randy Spivey, founder of the Center for Personal Protection and Safety, which licenses training videos to schools, including the UNC system, said the instruction is designed to make people aware of their options.

The company produced the video "Shots Fired, When Lightning Strikes" in 2007 after the Virginia Tech shooting which uses the terms “get out, hide out, take out.” That video was used as a reference by the DHS in the active shooter guidance it published in 2008.

"What we don't want is them to be frozen in fear with no options because they have no training," he said.

"Before first responders arrive, those students or your children are immediate responders, and they are in what we call that extreme danger gap," before police or other law enforcement arrive, Spivey said. "Many times, it's what they do between the 2, 5, 10-minute window that determines the outcome.”

People also need to learn the "red flags" that can offer clues that someone could become violent against others or themselves, Spivey said.

He said that training in recognizing signs of behavior that can precede violence is especially needed in K-12 schools, and his company has produced a video it will make available to schools free of charge.

"It's not just school shooters, but also some of those same indicators that someone is progressing towards violence, they're also for suicide," Spivey said.

Students pray together during a vigil at the University of North Carolina-Charlotte in Charlotte, N.C., on May 1, 2019. Chuck Burton / AP

Ken Trump, president of National School Safety and Security Services, which deals with school security and training for pre-K-12 schools only, says that anecdotally there has been an increase in some of those districts adopting "run, hide, fight" or other options-based training, but "the vast majority in our experience are still not doing that."

"You’re looking at asking kids to make life-and-death decisions and they're not emotionally, behaviorally and mentally developed to do that," he said, adding "we know the traditional lockdowns work."

The non-profit group Safe Havens International has studied options-based active shooter training in K-12 schools and in simulations at a southwestern U.S. school district, staff members who completed a five-hour training program based on "Run. Hide. Fight." were more likely to opt for force in a scenario involving a student with a handgun to his head.

In one out of four incidents, staff members who had the options-based training would opt to throw objects at or attack that student, and staff members who had not received formal training would begin talking to the student and encouraging him to put the gun down, the group's CEO wrote in a January 2018 article in the trade magazine Security Management.

"Colleges and higher ed have a lot more applicability in that concept [run, hide or fight] because there may be fewer areas accessible to lockdowns," and more open areas, Chris Dorn, senior analyst for the group, said Thursday.

Terrell was arrested and is charged with two counts of murder and four counts of attempted murder for the UNC Charlotte shooting. Officials told WCNC that Terrell was a history major at the school but had dropped out this semester.

A motive for the shooting, which occurred on the last day of classes, has not been released by police. A police report says that investigators do not believe Terrell knew the people killed in the attack.

In addition to Howell, student Ellis Parlier, 19, was also killed in the shooting. Four other students were wounded, but all are expected to survive, UNC Charlotte Chancellor Philip Dubois said.

The university issues the "run, hide, fight" guidance on its police website, and sent out alerts as the situation was unfolding for people to do just that.

Tristan Field, 19, who was inside the classroom when the gunman opened fire and followed a professor and others who fled, said in a message Wednesday over Twitter that they did what came naturally.

"We all just did what came naturally which was to run," Field said. "I just followed others. We didn't have a plan."