As gunfire echoed across the campus of Marjory Stoneman Douglas High School, police officers who got there first couldn’t tell where it was coming from — or even how many people were firing.

The confusion is outlined in documents and audio recordings released Thursday by the Broward Sheriff’s Office, three weeks after Nikolas Cruz opened fire in the high school, killing 17 and wounding 17 others in one of America’s worst school shootings.

The documents reveal a chaotic hour when police radios didn’t communicate with one another, victims were scattered around the 45-acre campus and responders couldn’t find the gunman before he slipped away in a crowd of panicked students and headed to Walmart.

The documents also raise further questions about the actions of school resource officer Scot Peterson, a sworn deputy

According to a timeline from the Sheriff’s Office, Peterson instructed other deputies to stay at least 500 feet away from the building, nearly eight minutes after the shooting began.

Cruz began to fire on students at 2:21 p.m. Feb. 14 in the school’s 1200 building, the freshman building, the Sheriff’s Office said.

Two minutes later, Peterson headed toward the 1200 building and told dispatchers that firecrackers or possible shots were fired. He set up near the east corner of the building and stayed there, calling for patrol cars and deputies to block nearby roads.

It’s not clear when other deputies arrived, but Peterson told a deputy at 2:24 p.m.: “We don’t have any description yet. We just hear shots, appears to be shots fired.”

At 2:25 p.m., a deputy reported, “I hear shots by the football field, shots fired by the football field.”

Peterson replied: “We’re looking at the 1200 building” and then, “Get the school locked down, gentlemen.”

Three minutes later, Peterson said, “Do not approach the 12 or 1300 building. Stay at least 500 feet away at this point.”

Peterson was the first deputy on the scene and initially acted as the commander. It is not clear why he would give an order to stay away from the building.

Active shooter training requires deputies to stop a gunman first and tend to victims when there is a break in gunfire. Peterson had that training, said Broward Sheriff’s Col. Jack Dale. Deputies also are trained to go in alone to face a shooter if necessary, he said.

Sheriff Scott Israel said earlier that Peterson should have “went in. Addressed the killer. Killed the killer.”

Peterson has since resigned as an internal investigation continues. His lawyer, Joseph DiRuzzo, has said that Peterson took the proper steps because he thought gunfire was coming from outside the building.

The information released Thursday is based on analysis of audio tapes, security video and 911 calls made to Coral Springs and Broward County dispatchers.

“Analysis of the audio tapes indicates that there was not a lot of accurate information. It was a rapidly evolving scene, and the sounds of gunfire were difficult to pinpoint,” Dale said.

“First responders have no information as to where the victims are, or where the shooter is or even the number of shooters,” he said. “So it’s difficult in the initial stages for them, from the sounds of gunfire, to determine where the shooter actually is or how many shooters are actually on campus.”

Coral Springs dispatchers got the first 911 call about the shooting a minute after it started. Cellular calls made to 911 in Parkland go to Coral Springs’ communications center.

The Coral Springs-Parkland Fire Department arrived about 2:28 p.m. and were ordered by the sheriff’s department to wait outside, Division Chief Michael Moser said.

“We were being advised on the radio from 911 callers and from police that the shooter was still shooting and still on the premises,” Moser said. His agency follows a national model calling for paramedics to stay out of an active shooter scene if it’s a “hot zone,” meaning a gunman is still firing.

“It wasn’t confirmed that he was dead, fled or was in custody when we arrived, and the Sheriff’s Office did not allow medics in, and that was the correct decision,” Moser said.

A Coral Springs police officer learned of the active shooter from city firefighters who were passing by. A dispatcher told the officer the 911 lines were “blowing up” and that gunshots could be heard during those calls.

At the scene, Coral Springs and sheriff’s personnel were not able to communicate on a common radio channel after a patch of the two systems didn’t work.

And the number of users overwhelmed radio systems, as they did during the mass shooting at Fort Lauderdale-Hollywood International Airport in January 2017. Some users were not able to transmit or receive calls, though the problem was not as severe as it was at the airport, Dale said.

At 2:27 p.m. a deputy “near the 900 or 1300 building” told dispatchers: “We’ve got shots fired. I’m trying to get the fence opened.”

At that same time, the shooting stopped and video recorded Cruz in a stairwell, discarding his weapon. He left the west side of the building and was later seen on the southwest part of the campus.

Two sheriff’s deputies tried to enter the 1300 building first, at 2:29 p.m., but it was locked.

Capt. Jan Jordan, captain of the agency’s Parkland District, said over the radio, “I know there is a lot going on, do we have a perimeter set up right now and everyone cleared out of the school?”

“That’s a negative,” a dispatcher told her.

Peterson told her: “We’re in total lockdown right now. Nobody’s leaving the school. Everybody’s on lockdown.”

Deputies moved on, at 2:32 p.m., to the 1200 building, the documents show.

The account differs from one from former Coral Springs Police Chief Chief Tony Pustizzi, who has since retired. He told the South Florida Sun Sentinel that Coral Springs police responded to the crisis “in minutes” and were the first inside the building.

The Sheriff’s Office said four Coral Springs officers were met at a west entrance by two deputies who helped bring victims to waiting Coral Springs-Parkland Fire Department paramedics.

“Within a very short period of time after arriving, we started getting patients brought to us, in golf carts and people carrying them and police bringing them,” said Moser, the fire department division chief. “There wasn’t a lot of time standing around. We were thrust into patient care right away.”

Moser said paramedics never went inside, but their SWAT medics did as the building was being cleared by police after Cruz had gone.

Jordan, the Parkland district chief, said over the radio at 2:32 p.m. that SWAT units are on the way. Then she said, “I want to make sure that we have a perimeter set up. … All the kids are getting out, but we need to shut down around this school.”

A deputy told her, “We have two teams going in [to the school], checking right now.”

As police searched for the gunman inside the building, Cruz was walking away.

His first stop was a Subway shop inside a Walmart, at 6001 Coral Ridge Drive in Parkland, where he bought a drink. He rested at a McDonald’s at 5741 Coral Ridge Drive in Coral Springs and then continued along the 4700 block of Wyndham Lakes Drive in Coral Springs.

An hour and 12 minutes after Cruz left the blood-soaked campus terrorized, a Coconut Creek police officer “coordinated his arrest” on Wyndham Lakes Drive, 2½ miles from the school.

Cruz now sits in a Broward County jail. The sheriff’s office says he has confessed, and a grand jury has indicted him on 17 counts of murder and 17 counts of attempted murder.

Asked whether police response time at the 1200 building was acceptable, Dale said: “I don’t know what acceptable is. I will tell you that given the amount of information that was coming in, via the two different channels, and the two different sources, at some point they assessed the situation, they were relayed the information from Coral Springs that there were people down on the ground in Room 1216, they formulated a plan and they executed it.”