FORT LAUDERDALE, Fla. (Reuters) - The armed sheriff’s deputy assigned to the Florida high school where 17 people were shot dead has resigned rather than face suspension after an internal investigation showed he failed to enter the school to confront the gunman during the attack, the county sheriff said on Thursday.

Deputy Scot Peterson, who was on duty and in uniform as the resource officer posted at Marjory Stoneman Douglas High School, was the only law enforcement officer present on Feb. 14 when the rampage started, Broward County Sheriff Scott Israel said.

Peterson’s actions were caught on video during the massacre, which ranks as the second-deadliest shooting ever at a U.S. public school, carried out by a lone gunman wielding a semiautomatic AR-15-style assault rifle.

Nikolas Cruz, a 19-year-old former student, was later arrested and charged with 17 counts of premeditated murder in the assault.

“What I saw was a deputy arrive at the west side of Building 12, take up a position and he never went in,” Israel said, referring to the building on campus where authorities said the bulk of the shooting occurred.

Israel told reporters the shooting in the Fort Lauderdale suburb of Parkland lasted six minutes, and that Peterson reached the building under attack about 90 seconds after the first shots were fired, then lingered outside for at least four minutes.

Asked what the deputy should have done, Israel replied, “Went in. Addressed the killer. Killed the killer.”

Peterson has not given a reason for why he did not enter the building, Israel said. Neither the deputy nor any representatives could immediately be reached for comment.

Israel said he had decided on the basis of his review of the video to suspend Peterson, but the deputy resigned first.

A woman mourns in front of the fence of the Marjory Stoneman Douglas High School. REUTERS/Carlos Garcia Rawlins

The sheriff said two other deputies have been placed on restricted duty pending an internal investigation into whether they properly handled two telephone tips, received in 2016 and 2017, warning that Cruz might be inclined to commit a school shooting.

Authorities have said that Cruz, who was expelled from Stoneman Douglas High last year for unspecified disciplinary problems, made his getaway moments after the shooting by blending in with students fleeing the school for safety.

LAW ENFORCEMENT RESPONSE UNDER SCRUTINY

Police officers arriving on the scene from the adjacent city of Coral Springs thought the gunman was still inside as they searched the building, based on a security camera video feed that they mistakenly believed was showing them real-time images but was actually footage from 20 minutes earlier.

Coral Springs Police Chief Tony Pustizzi told reporters on Thursday that the confusion stemmed from human error and a “communication failure,” not malfunctioning equipment. He insisted that the mishap did not put any lives in danger.

Still, the disclosure may help explain the time lapse between the shooting and the suspect’s arrest.

The Broward sheriff has said Cruz, after slipping away from the school, casually spent more than an hour drifting through a Walmart store and visiting two fast-food outlets before he was spotted and taken into custody without a struggle.

The shooting has renewed a national debate between proponents of gun rights, as enshrined in the Second Amendment to the U.S. Constitution, and advocates for tougher restrictions on firearms.

High school students from Stoneman Douglas and elsewhere around the country have launched a protest and lobbying campaign demanding new curbs on assault weapons. U.S. President Donald Trump has suggested school gun violence could be abated by arming teachers.

On Thursday, the head of the National Rifle Association, Wayne LaPierre, lashed out at gun control advocates, accusing liberal elites of politicizing the Florida mass shooting to try to attack “our firearms freedoms so they can eradicate all individual freedoms.”

The carnage also has raised questions about whether law enforcement agencies did all they could to detect and follow up on possible warning signs of last week’s gun violence in advance.

The Broward sheriff’s office received at least 18 calls for service or tips about Cruz during the past decade, and internal affairs detectives are still reviewing two of them to determine if they were properly handled, Israel said.

In one instance from February 2016, the sheriff’s office received information from a neighbor’s son that Cruz “planned to shoot up” a school, based on an Instagram post with a picture of a “juvenile with guns,” according to an agency fact sheet released to the media. A deputy subsequently determined Cruz possessed knives and a BB gun and notified a school resource officer, the document said.

In a more recent incident dated Nov. 30, 2017, a caller told the sheriff’s office that Cruz was collecting guns and knives and “could be a school shooter in the making,” according to the fact sheet. The tipster, it said, advised that the weapons were kept at a friend’s house at an unknown location.

A deputy in that case referred the caller to the Palm Beach Sheriff’s Office because Cruz was said to have moved to that jurisdiction, the Broward sheriff’s office said.

The Federal Bureau of Investigation prompted widespread outrage last Friday when it said it had failed to act on a tip warning that a man, since identified as Cruz, had possessed a gun, the desire to kill and the potential to commit a school shooting.