Authorities later announced that they had taken the suspect into custody and took him to hospital after locating him in Coral Springs, a little over a mile away from the school. The gunman surrendered to police without a struggle, Broward County Sheriff Scott Israel said.

Flagged as a threat

Jim Gard, a maths teacher, said Cruz had been in his class last year.

“We were told last year that he wasn’t allowed on campus with a backpack on him,” Mr Gard told the Miami Herald. “There were problems with him last year threatening students.”

However, Robert Runcie, the Broward County School District Superintendent, told reporters he was not aware of any concerns raised about the student.

“We received no warnings,” Mr Runcie said outside the school. “Potentially there could have been signs out there. But we didn’t have any warning or phone calls or threats that were made.”

People react at Marjory Stoneman Douglas High School in Parkland, FloridaCredit:
AFP

One student, who did not wish to be named, told TV station WSVN-7 that Cruz had said he had guns at home and talked about using them.

“He’s been a troubled kid,” the student said. “He’s always had a certain amount of issues going on. He shot guns because he felt it gave him, I guess, an exhilarating feeling.”

‘Very disturbing’ social media history

Mr Israel said the gunman had an AR-15 assault rifle and “countless magazines”.

“We already began to dissect his websites and the things on social media that he was on and some of the things that came to mind are very, very disturbing,” he said.

One pupil said other teenagers had long thought the suspect would “shoot up the school”.

The pupil told local television station WFOR-TV: “A lot of people were saying it was going to be him. A lot of kids threw jokes around saying that he was going to be the one to shoot up the school. It turns out that everyone predicted it. That’s crazy.”

Broward County Mayor Beam Furr said during an interview with CNN that the shooter was getting treatment at a mental health clinic for a while, but that he hadn’t been back to the clinic for more than a year.

“It wasn’t like there wasn’t concern for him,” Mr Furr said. “We try to keep our eyes out on those kids who aren’t connected … Most teachers try to steer them toward some kind of connections. … In this case, we didn’t find a way to connect with this kid.”

Another student, named as Brandon, was asked whether he was surprised to learn the identity of the gunman, and replied: “No.” He continued: “He told me he got kicked out of two private schools, and was held back twice. He seemed a little off.”

‘Crazy about guns’

Chad Williams, 18, a senior at Stoneman Douglas High school, remembered Cruz as a troubled classmate from when they attended middle school together. He said Cruz would set off the fire alarm, day after day, and finally got expelled in the eighth grade.

Police escort a suspect into the Broward Jail after checking him at the hospital following a shooting incident at Marjory Stoneman Douglas High School in ParklandCredit:
Reuters

More recently, Williams saw Cruz carrying several publications about guns when they ran into each other at the high school. Williams thought Cruz was there to pick up a younger sibling.

“He was crazy about guns,” Williams told Reuters, speaking by the side of the road near the high school. “He was kind of an outcast. He didn’t have many friends. He would do anything crazy for a laugh, but he was trouble.”

Victoria Olvera, a 17-year-old junior, said Cruz was expelled last school year after a fight with his ex-girlfriend’s new boyfriend. She said Cruz had been abusive to his girlfriend.

Daniel Huerfano, a student who fled Wednesday’s attack, said he recognised Cruz from an Instagram photo in which Cruz posed with a gun in front of his face.

Florida Governor Rick Scott speaks to the media as he visits Marjory Stoneman Douglas High School Credit:
AFP

Huerfano recalled Cruz as a shy student and remembered seeing him walking around with his lunch bag.

“He was that weird kid that you see … like a loner,” he added.

Dakota Mutchler, a 17-year-old junior, said he used to be close friends with Cruz but hadn’t seen him in more than a year following his expulsion from school.

Suspect ‘posted about killing animals’

“He started progressively getting a little more weird,” Mutchler said.

Mutchler recalled Cruz posting on Instagram about killing animals and said he had talked about doing target practice in his backyard with a pellet gun.

“He started going after one of my friends, threatening her, and I cut him off from there,” Mutchler said.

“I think everyone had in their minds if anybody was going to do it, it was going to be him,” Mutchler said.

Travis Julmice, an 18-year-old senior, said he had not been in a class with Cruz since middle school.

“You could tell he was a little off,” Julmice told Reuters at the Coral Springs hotel. “He was always like a troubled kid, getting in-school suspension a lot. And detentions.”