PARKLAND, Fla. — A heavily armed teen barged into his former high school about an hour northwest of Miami on Wednesday, opening fire on terrified students and teachers and leaving a death toll of 17 that could rise even higher, authorities said.
Students huddled in horror in classrooms and closets, with some of them training their cellphones on the carnage, capturing sprawled bodies, screams, and gunfire that began with a few shots, then more and more. The dead included students and adults; some were shot outside the school and others inside the three-story building.
The gunman, armed with a semi-automatic AR-15 rifle, was identified as Nikolas Cruz, 19, who had been expelled from the school, authorities said. He began his shooting rampage outside Marjory Stoneman Douglas High School in this suburban neighborhood shortly before dismissal time around 2:40 p.m. He then went inside and proceeded down hallways he knew well, firing at students and teachers who were scurrying for cover, the authorities said.
“Oh my God! Oh my God!” one student yelled over and over in one video circulating on social media, as more than 40 gunshots boomed in the background.
By the end of the rampage, Cruz had killed 12 people inside the school and three outside it, including someone standing on a street corner, Broward County Sheriff Scott Israel said. Two more victims died of their injuries in hospitals. The aftermath at the school was an eerie shrine, with chairs upended, a computer screen shattered with bullet holes, and floors stained with blood.
“This is catastrophic,” said Israel, who has three children who graduated from the high school. “There really are no words.”
It was the nation’s deadliest school shooting since a gunman attacked the Sandy Hook Elementary school in Newtown, Conn., in 2012, killing 20 students and six teachers.
Cruz was arrested in Coral Springs, a neighboring city, about an hour after fleeing the shootings, authorities said. He had slipped out of the building by mixing in with crowds of students. In addition to the rifle, Israel said, Cruz had “countless magazines.”
The gunman had clearly prepared for the attack, Senator Bill Nelson of Florida said in an interview after speaking to the FBI. “The shooter wore a gas mask, had smoke grenades, and he set off the fire alarm so the kids would come out of the classrooms,” said Nelson, citing details he learned from the FBI. Several students said they found it strange to hear the alarm, because they had had a fire drill earlier in the day.
The gunman fled to Coral Springs, police said. Just after 3 p.m., Michael Nembhard — a retiree who lives in Coral Springs, just south of Parkland — was sitting in his garage watching the TV news when he heard an officer yell, ‘‘Get on the ground!’’
He said he looked out and saw police arrest the shooting suspect. The teenager was on the ground, wearing a burgundy hoodie and dark pants.
‘‘The cop had his gun drawn and pointed at him,’’ Nembhard said in a phone interview.
The sheriff said he did not know the gunman’s motive. He said a football coach was among the dead, and the son of a deputy sheriff among the injured. Twelve of the 17 dead had been identified by Wednesday night, he added, noting that not all of the students had backpacks or wallets on them.
Cruz was enrolled at another Broward County school, officials said.
Israel said law enforcement officials had found material on Cruz’s social media accounts that was “very, very disturbing.”
Jim Gard, a math teacher at the school, said Cruz was in his class in 2016 and appeared to be a “quiet” student. But Gard also recalled that there was concern about his behavior on the part of the school administration, which e-mailed teachers relaying those fears.
Gard said after the shooting, he learned from several students that Cruz was obsessed with a girl at the school to the point of “stalking her,” a point authorities did not raise in news briefings near the scene.
More than 40 “active shooter” episodes in schools have been recorded in the United States since 2000, according to FBI and news reports. Two 15-year-old students were killed and 18 more people were injured last month in a school in rural Benton, Ky.
The shootings have become common enough that many schools, including Douglas High, run annual drills in which students practice huddling in classrooms.
After the gunfire had stopped Wednesday afternoon, students ran out of the school, some in single file with their hands on the shoulders of those in front of them and others in all-out sprints. As the students sought cover, law enforcement officers armed with military-grade weapons swarmed the building. Parents rushed to a local Marriott hotel to reunite with their children.
Ryan Gutierrez, 18, a senior, walked the 2 miles from the school to a 7-Eleven in Coral Springs — the nearest spot where his parents could meet him. Every other road leading to the school was blocked by police cars.
His parents had already been reunited with his sister, Nicole, a freshman. As Gutierrez approached, his mother ran up, hugged him hard, and started crying. Gutierrez comforted her as his father hugged both.
‘‘This has been so horrible, the most horrible day anyone can imagine,’’ Gutierrez’s mother, Diana, said, trying to stop her tears. ‘‘It’s unreal, just unreal. I still don’t believe it.’’
Nicole said the assault was made more confusing because the school had just held an assembly on emergencies.
‘‘They were telling us what to do in a Code Red, a Code Yellow and all that stuff,’’ Nicole said. ‘‘And then we had a fire drill in the morning, and that was normal. And then this afternoon . . . Nobody knew what to believe.’’
Security officers had told the students at the assembly that they might have a drill during which police would fire blank shots, to simulate gunfire, Ryan said. ‘‘So when we were hiding in the room, people were saying they heard gunshots, and we didn’t know if it was real,’’ he said.
The attack is likely to revive a debate over gun control, though efforts to legislate restrictions on firearms following previous school shootings largely proved fruitless.
President Trump said he had been briefed on the shooting and tweeted, ‘‘My prayers and condolences to the families of the victims of the terrible Florida shooting. No child, teacher or anyone else should ever feel unsafe in an American school.’’
Representative Seth Moulton, a Massachusetts Democrat, then quote-tweeted the president, saying he agreed with Trump’s sentiment, adding: “I invite him to get off his ass and join me in trying to do something about it.”
Parkland Mayor Christine Hunschofsky, a Boston native, described her city as “a very close-knit community, and a very safe community.”
“It shows that something like this can happen anywhere,” Hunschofsky said.
The survivors spoke of sheer horror and frantic confusion. Janet Hughes was meeting with her son, Justin, 16, a junior, and his guidance counselors when the Code Red was announced. ‘‘They grabbed my arm and dragged me one way, and they took him in another direction,’’ Hughes said. ‘‘I ended up lying on the floor with the seven other adults in office for 2½ hours. . . . Nobody knew anything.’’
Justin was corralled into a small room, where he spent the next 2½ hours crammed with 70 other students.
Denise Loughran was reunited with her 17-year-old son, Liam, within a few hours of the shooting. But they still hadn’t heard from his sister, Cara, a freshman.
‘‘Her phone must be in her backpack, and they made them drop their backpacks when they ran out,’’ Loughran said. ‘‘This has just been chaos. I couldn’t get near the school. My husband took a bike to try to get there, and they ended up sending him to the hotel, where they said they were taking the kids.
‘‘But she’s not there.’’Danny McDonald of the Globe Staff contributed to this report. Material from the Washington Post was also used.