An armed school deputy rushed to the Florida high school building where terrified students ran from a killer with an assault rifle, but then sat outside for about four minutes and never went inside.

The school resource deputy for Marjory Stoneman Douglas High School, Scot Peterson, was under investigation for his response to the shooting but then decided to resign his post, Broward County Sheriff Scott Israel said Thursday.

Two other deputies are also under investigation after a review of prior law enforcement calls involving accused gunman Nikolas Cruz spurred questions on whether the deputies followed the department's policies. 

"It's devastating," Israel said during a Thursday news conference. "I'm sick to my stomach. These families lost children, we lost coaches." 

Peterson, 54, started working for the Broward County Sheriff's Office in 1985 and since 2009 has been a school resource officer at the high school, appointed to keep the school and its students safe. In 2016, his annual salary was more than $75,600.

Israel said surveillance footage captured Peterson responding to the building where the shooting was unfolding. He said the deputy got there within a minute and a half of when the gunfire started. He positioned himself outside the building but never went in, Israel said.

The shooting lasted a total of six minutes. Peterson sat outside the building for four of those minutes, Israel said. In the end, 17 people were killed. 

He should have "went in, addressed the killer, killed the killer," Israel said. 

Modern active shooter procedures were changed after the Columbine High School shooting in 1999 when officers were trained to wait for SWAT officers to respond and take out a threat. The officers in that shooting allowed the suspects to continue their rampage without being challenged. In the end, 13 people were killed. 

Officers are now trained to go toward gunfire, even if alone and outgunned, because research has shown the presence of law enforcement can slow down or stop a suspect, potentially bringing the death toll down and preventing future deaths. 

"When we in law enforcement arrive to an active shooter, we go in and address the target and that's what should have been done," Israel said. 

But responding alone could be deadly. A study by Texas State University of 84 active shooter incidents from 2000 to 2010 found that 33 percent of officers who faced active gunman alone were shot, though an even higher percentage of attackers were stopped. 

But those officers can make all the difference. The Department of Justice says most shootings are over within 5 minutes and the first officers who arrive at the scene of a active shooter can save many lives. 

Before the shooting, Peterson was investigated by his department on two other occasions.

In 2015, he was accused of not using common sense and good judgement when he wrote an email that questioned the management of the then chief of Broward County School District's police department, Anthony Williams, according to internal affairs reports in his personnel file. 

He was writing to complain that Williams wanted to dissolve the Resident On Campus Security (ROCS) Program at Atlantic Technical College, which, he wrote, would have eliminated one of his two jobs patrolling campuses, as he was also working at Stoneman Douglas High School.

“I submit to the School Board members that despite Chief Williams failure to supervise the ROCS program, we still everyday protect our kids and school campuses," he said in the email.

The department recommended he be counseled after the incident. 

He was also investigated in 1994 for conduct unbecoming of an employee but that charge was considered unfounded and dropped. 

The Broward County Sheriff's Office on Thursday also released information on nearly two dozen calls that involved Cruz and his family. Israel said he placed deputies in two of the calls under investigation because there were questions whether more should have been done. The calls stemmed back to 2008 and all were made prior to last week's shooting. 

Maria Perez, Naples Daily News contributed to this report. Follow Christal Hayes on Twitter: Journo_Christal