Seventeen people were shot to death and several others wounded Wednesday at Marjory Stoneman Douglas High School in Parkland, Florida, in a horrific episode of school violence that ended with the arrest of a former student.

Panicked parents streamed to this affluent section of northwest Broward County, as news helicopters broadcast the incident live, police officers crouched behind cars with guns drawn and students congregated on streets, many crying, hugging and calling friends and family.

In a grainy Snapchat video from the school, a man yelled, “Oh, my God,” as the pop-pop, pop-pop of gunshots rang out and students screamed.

Broward Sheriff Scott Israel said 17 people were killed, including both students and adults, with two shot outside the school, one in the street, 12 inside the school and two dying from their wounds at the hospital.

The suspect was identified as Nikolas Cruz, 19, who had been expelled from the school. He used an AR-15 rifle and had multiple magazines, the sheriff said. Investigators have begun analyzing Cruz’s social media accounts, which the sheriff said contained material that was “very, very disturbing.”

Cruz was taken into custody off campus without incident, he said. Wearing a red shirt, black pants and black boots, Cruz was seen being placed on a gurney. At 4:47 p.m. he was seen being wheeled into Broward Health North hospital in Deerfield Beach. Later he was taken from the hospital to Broward Sheriff’s Office headquarters in Fort Lauderdale.

“People are still undergoing surgery,” Israel said. “We just pray for this city, pray for this school, the parents, the folks that lost their lives. It’s a horrific, horrific day.”

Among those shot was the school’s athletic director, Chris Hixon, according to the school’s assistant athletic director Marilyn Rule. No information was immediately available on his condition.

Sixteen people were being treated at area hospitals. Seven victims were being treated at Broward Health Medical Center in Fort Lauderdale, Dr. Benny Menendez told a crowd of reporters. Two were in critical condition and five were stable. Nine were taken to Broward Health North Medical Center, where three were in critical condition.

“We do drills and when this happens we’re ready,” Menendez said. “We practice for this.”

FBI agents were on the scene interviewing students asking for anyone who saw the shooter.

“You’re ok!” One student said as she cried and hugged her friend who had just come out. “You’re safe now, don’t worry.”

Samuel Dykes, a freshman, was on the third floor of the school when he said he heard gunshots, and saw several bodies in a classroom.

SWAT told the class to keep their eyes forward as they exited the school, he said.

At around dismissal time at 2:40 p.m., staff and students heard what sounded like gunfire and enacted a “code red” lock down, according to the Broward School District.

A television news helicopter report showed several people on gurneys being placed into fire rescue ambulances and groups of children walking across Northwest Pine Island Road. Television news cameras showed a young man with reddish hair wearing a red shirt who was surrounded by SWAT officers and put in handcuffs and being taken into custody.

“It’s a horrific situation,” Broward County Superintendent Robert Runcie said. “It’s just a horrible day for us.”

Students were streaming down Pine Island Road at 3:30. Some of them crying, some were talking on cell phones.

Meghan Walton’s mascara was running as she walked down Pine Island Road with her mother. Derval Walton. She was waiting in the car line to pick her 15 year old freshman daughter up when she got the ominous text from her: “Code Red”

“Kids were running out full of blood,” Derval Walton said. “Kids were falling in the grass.”

Hannah Siren, 14, was in math class on the third floor.

“The people next door to us must have not locked their door,” she said, breaking into tears. “They all got shot”

How many?

“10 or … 7”

Andy Pedroza, 18, of Parkland, was returning to class when he heard shots.

“My instincts kicked in,” he said. He ran to the bathroom and hid in a stall. “The toilet was slippery and I thought I would make too much noise,” he said, so he didn’t crouch on the toilet.

He waited what he thought was at least 20 minutes until the shooting stopped, then he heard the sirens and the police chatter on their radios.

He walked out of the bathroom, and police directed him outside, patted him down and said, “Just run.”

President Trump 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.”

Deputy White House Press Secretary Lindsay Walters said, “We are monitoring the situation,” she said. “Our thoughts and prayers are with those affected.”

Gov. Rick Scott announced plans to come to Broward County immediately. He spoke on the phone with Broward Sheriff Scott Israel, Broward schools superintendent Robert Runcie and Florida Department of Law Enforcement Commissioner Rick Swearingen, according to the governor’s office.

Florida Attorney General Pam Bondi said she was on her way to the area.

“Praying for everyone involved in today’s shooting at Marjory Stoneman Douglas High School,” she said in a statement issued by her office. “I am on the way with my victim advocates and we will be available in full force to help all victims and their families with any services they need.”

There are 3,208 children in grades 9 — 12 enrolled at the school.

Parents at area schools — including Sawgrass Springs Middle School and Westglades Middle School — said they received texts that those campuses were locked down.

Watch live coverage here.

All Broward school district athletic events were canceled for that night.

Jay Golden, of Parkland, has a daughter Rachel who was at the school when the first sign of problem came. Rachel, a senior, texted him that there was a Code Red, a shooting, and she didn’t know if it was real or a drill.

At 3 p.m. she still hadn’t been evacuated from the 900 building, but told her father she was safe with 40 other students and a teacher.

“She was crying, she’s scared,” he said. “She’s been texting back and forth. She’s OK at the moment.”

“I’m freaking out,” her father said. “This is crazy, this stuff shouldn’t be going on in these schools. People are crazy. I don’t know what goes on through these people’s minds these days, it’s a scary thing. It’s one of those things – you don’t want to put a metal protector and treat them like prisoners but they have to figure something out. You put your kids in school and it’s supposed to be a safe place and this stuff happens all the time.”

The FBI is asking anyone with information to call 1-800-Call-FBI.

Susannah Bryan, Gary Curreri, Anne Geggis, Skyler Swisher and Scott Travis contributed to this report.