A high school student who survived the deadly Florida shooting on Valentine’s Day that left 17 people dead has slammed his teacher on social media, calling him an “opportunist” and “a coward,” after he allegedly wouldn’t unlock his classroom door and let students in, a report from the Sun-Sentinel said on Friday.

Josh Gallagher, a junior at Marjory Stoneman Douglas High School in Parkland, Fla., shared his account on Twitter. He said he was in math class with his teacher Jim Gard when the fire alarm went off. Students began to evacuate, and while Gallagher was near the stairwell, he said they heard shots being fired.

Kids started to retreat back toward their classroom, Gallagher said, only to find a locked door.

NEW PICTURES: PARKLAND SHOOTER MIGHT HAVE TRIED TO CREATE VANTAGE POINT TO FIRE BELOW

Gallagher, along with more than a dozen other students, was “left in the hallways ducking as the screams of classmates and gunshots took over the noise around me,” he tweeted. “We were stuck in the hall for 4 total minutes ducking and in fear for our lives.”

While Gallagher was on the phone with his dad, who he said is a first responder, another teacher who he’d “never seen before” allowed the group of kids to come inside.

After the shooting, Gallagher said he learned that his teacher allegedly “ran back into the classroom without turning around and locked his door.”

“He left 75% of his students out in the hallway to be slaughtered,” the student claimed in the post.

Gallagher goes on accuse his teacher of being an “opportunist” and someone who shouldn’t be seen “as close to a hero.”

FLORIDA SCHOOL SHOOTING TIMELINE

The teacher told the Sun-Sentinel the students fell behind in the drill and got stuck outside the room. He only acted in accordance with protocol, Gard said, which tells teachers to lock their doors in the event of a drill or actual active-shooter event.

“I looked back down the hall and no one was around — no one,” Gard said. “You have to close the door. That’s protocol. We have no choice.”

He told the outlet that all the kids managed to find a safe spot to hide.

Gard told the paper that six students returned to his classroom after the assumed fire drill and were all crowded near his desk when they heard banging at the door. “I told the kids we can’t let anyone in,” he said. “We had no idea if it was a drill or not. By the time I walked over to the door, the banging had stopped. I didn’t hear any yelling. If there were 13 kids outside the door screaming and banging I would have heard them.”

FLORIDA SCHOOL SHOOTING SURVIVORS MAKE EMOTIONAL RETURN TO STONEMAN DOUGLAS

Gard said after they heard helicopters above the building and saw news reports, they discovered what was happening. The group reached out via text to their classmates, whom he said were all OK.

But at an open house held at the Parkland high school last Sunday, the teacher said he was confronted by Gallagher and his father.

“All of a sudden this kid comes over and starts screaming at me,” Gard said. “Then his father started screaming at me. This is insane.”

Gallagher and his family declined to speak to the Sentinel. But in a message to them on Twitter, the student reportedly said he didn’t want “to sensationalize” what happened.

“I want change to happen when it comes to protocol and the way this situation is handled,” he told the outlet. “No child can feel the way I did.”