Florida school had recently had meeting to discuss plan in case of gun attack
17 people died in the deadly incident which is the 18th school shooting in the US this year
The school where a gunman opened fire shortly before class was dismissed for the day had only recently had a meeting about what to do in the event of such an attack.
The violence erupted shortly before dismissal at Marjory Stoneman Douglas High School in Parkland, about 72 km north of Miami. Live television footage showed students streaming out of the building as dozens of police and emergency services personnel swarmed the area.
Staff and students told local media that a fire alarm went off around the time the shooting started, sparking chaos as some 3,000 students at the school first headed into hallways before teachers herded them back into classrooms, to seek shelter in closets.
Kyle Yeoward, a 16-year-old junior, told Reuters he was in the bathroom on the second floor of the building on the campus where most of the shooting took place, when he heard two shots.
"He let loose on the freshman building," Yeoward said.
The school had recently held a meeting to discuss what to do in such an attack, Ryan Gott, a 15-year-old freshman told CNN.
McKenzie Hartley (19) who identified herself as the sister of a student at the school described the scene in a text message to Reuters: "She heard him shooting through the windows of classrooms and two students were shot."
Panicked parents checked on their children.
"It is just absolutely horrifying. I can't believe this is happening," Lissette Rozenblat, whose daughter goes to the school, told CNN. Her daughter called her to say she was safe but the student also told her mother she heard the cries of a person who was shot.
"She was very nervous. She said that she could hear the person who was shot crying out for help," she said.
Televised images showed dozens of students, their arms in the air, weaving their way between law enforcement officers with heavy weapons and helmets, and large numbers of emergency vehicles including police cars, ambulances and fire trucks.
"My prayers and condolences to the families of the victims of the terrible Florida shooting," U.S. President Donald Trump said on Twitter. "No child, teacher or anyone else should ever feel unsafe in an American school."
Parent John Obin said his son, a student at the school, was in class when he heard several shots.
The father said his son advised that teachers quickly rushed students out of the school.
"This is a really good school, and now it's like a war zone," Mr Obin said.
The suspected shooter, 19-year-old Nikolas Cruz, was an ex-student of the school who was expelled from the school for disciplinary reasons.
Additional reporting by Press Association