The disgraced Florida sheriff’s deputy who explained his failure to act during the school massacre by saying he believed the shooter was outside actually radioed that gunfire was inside, according to a report.

Scot Peterson, who resigned as school resource officer, also warned fellow cops to stay away from Marjory Stoneman Douglas High School as Nikolas Cruz fled after allegedly killing 17 people, the Miami Herald reported.

“Do not approach the 12 or 1300 building, stay at least 500 feet away,” Peterson said over the radio, according to internal radio dispatches released Thursday.

Sheriff’s office protocol calls for deputies to engage an active shooter until the threat is eliminated.

The police chatter and second-by-second timeline sheds new light on the Valentine’s Day massacre — appearing to back Sheriff Scott Israel’s contention that Peterson should have entered the building.

They also appear to show that other deputies may have stayed outside the school at Peterson’s direction. The Florida Department of Law Enforcement is reviewing the police agency’s response.

Broward Sheriff’s Office police union head Jeff Bell welcomed the release of recordings from his agency and Coral Springs police.

“It certainly backs up that he never went into the school,” Bell said of Peterson, according to the Herald. “At one point he says to keep back 500 feet. Why would he say that?”

According to the timeline, Cruz was dropped off at the school by an Uber at 2:19 p.m., entered two minutes later and began firing within 15 seconds, when Peterson was near the administration building.

At 2:22 p.m., the fire alarm sounded throughout the entire campus and the first 911 call went out via the Coral Springs emergency dispatch center.

“Be advised we have possible, could be firecrackers. I think we have shots fired, possible shots fired —1200 building,” Peterson radioed at 2:23 p.m.

Video shows that Peterson arrived at the southeast corner of Building 12, where he appeared to remain until the shooting was over.

“We’re talking about the 1200 building, it’s going to be the building off Holmberg Road,” he said within seconds. “Get the school locked down, gentlemen.”

As the gunfire intensified, other officers arrived and radioed in. One thought he heard shots by the football field, something Peterson mentioned in a statement released by his attorney, arguing that Peterson believed shots were coming from outside the 1200 building.

“BSO trains its officers that in the event of outdoor gunfire one is to seek cover and assess the situation in order to communicate what one observes with other law enforcement,” Peterson said.

But according to the timeline, Peterson remained focused on Building 12.

“All right … We also heard it’s by, inside the 1200,” he said at 2:25 p.m.

When students began fleeing from the campus, Peterson radioed to make sure “no one comes inside the school.”

Seconds after Cruz ditched his AR-15 and left, Peterson radioed for officers to “stay at least 500 feet away at this point.”

At 2:32 p.m. — 11 minutes after the shooting began — four Coral Springs cops and two sheriff’s deputies made the first police entrance into the building and helped remove a victim.

By 3:30 p.m., a Coconut Creek officer collared Cruz, who has been charged with multiple counts of first-degree murder and attempted murder.

Peterson’s attorney Joseph DiRuzzo did not respond to the Herald’s requests for comment about the radio recording and timeline.