The FBI was warned last year about an ominous online comment by the 19-year-old man accused of killing 17 people in his former high school but was unable to locate him, according to an agent.

Authorities have said that Nikolas Cruz walked into the Marjory Stoneman Douglas High School in Parkland and opened fire with an AR-15-style assault rifle.

Cruz may have left warning signs on social media in the form of a comment on a YouTube video that read: "I'm going to be a professional school shooter."

That comment troubled the person whose video Cruz commented on, Mississippi bail bondsman Ben Bennight, who passed it on to the FBI, according to a video he posted online yesterday.

"No other information was included with that comment which would indicate a time, location or the true identity of the person who made the comment," FBI Special Agent in Charge Robert Lasky told reporters.

Investigators were unable to find the commenter, he added.

The FBI is conducting an extensive review of how it handled that tip to see if mistakes were made, a federal law enforcement official told Reuters.

He has appeared in court, charged with 17 counts of premeditated murder. 

In a brief court appearance, Cruz spoke only two words, "Yes ma'am," when a judge asked him to confirm his name. He was ordered to be held without bond.

Cruz's court-appointed lawyer said he had expressed remorse for his crimes.

"He's a broken human being," public defender Melisa McNeill told reporters. "He's sad, he's mournful he's remorseful."

A former student at the school, Cruz was expelled for "disciplinary reasons", and is currently enrolled in Broward County Public Schools.

Cruz, described by fellow students as "troubled," was arrested without incident in the nearby town of Coral Springs after the shooting and taken to hospital with minor injuries, according to Sheriff Scott Israel.

"We have already begun to dissect his websites and things on social media that he was on and some of the things ... are very, very disturbing," Sheriff Israel said.

"If a person is predisposed to commit such a horrific event by going to a school and shooting people ... there's not anybody or not a lot law enforcement can do about it."

He said both students and adults had been killed, 12 of whom have now been identified.

Sheriff Israel said at least 14 people were taken to hospital and two had died there of their wounds.

He added that one of those killed was a football coach, and one student injured was a deputy sheriff's son.

Aaron Feis was one of those who was killed

The first victim of the attack has been publicly named as Aaron Feis, an assistant coach of the school's football team who was shot while shielding students.

"This is a terrible day for Parkland," Sheriff Israel said, speaking of the city of about 30,000 people, located 80km north of Miami.

Read More: 

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

A teacher at the school said Cruz had been identified previously as a potential threat to his classmates.

"We were told last year that he wasn't allowed on campus with a backpack on him," maths teacher Jim Gard said in a Miami Herald interview.

"There were problems with him last year threatening students, and I guess he was asked to leave campus."

Cruz was also said to have been in the Junior ROTC (Reserve Officers' Training Corps) programme while at school.

A law enforcement source told CBS News that the gunman pulled a fire alarm before opening fire, but Sheriff Israel could not confirm that report.

The shooting, one of 18 at a school since the start of the year, will once again throw the spotlight on the epidemic of gun violence in the United States, where there are 33,000 gun-related deaths annually.

But when questioned at a press conference, Florida Governor Rick Scott - who described the massacre as "just pure evil" - declined to make a statement on gun control in the aftermath of the shooting.

"There's a time to continue to have these conversations about how through law enforcement, how through mental illness funding that we make sure people are safe, and we'll continue to do that," said Mr Scott, a Republican.

At the same briefing, Florida Attorney General Pam Bondi said the state will cover the costs of funerals and counselling for survivors.

People walk out of a hotel where students were quickly taken after the mass shooting

Students, some with their hands in the air, were led out of the school by heavily armed police officers and an armored vehicle filled with a SWAT team on the scene.

Student Jeiella Dodoo told CBS News that she and her schoolmates evacuated calmly after hearing what they thought was a routine fire alarm.

"The alarm went off so we had to evacuate from our classes," she said. "Then we heard gunshots.

"I heard about six gunshots," she said, "and then some people started running and then everyone started running because we were like 'If it's real, then just run'."

Teacher Melissa Falkowski told US networks that she had helped 19 students squeeze into a closet with her.

"We were in there for probably 40 minutes. We were locked in the closet until SWAT came and got us," she told CNN.

Police officers in helmets, bulletproof vests and armed with automatic weapons could be seen stationed at several points around the sprawling school complex, which serves nearly 3,000 students.

"Just a horrible day for us," said the superintendent of the county's school district, Robert Runcie.

US President Donald Trump offered his "prayers and condolences to the families of the victims" on Twitter.

But since January 2013, there have been at least 291 school shootings across the country - an average of about one a week, according to Everytown for Gun Safety, a non-profit group that advocates for gun control.

"It is pretty clear that we're failing our kids here," said Ms Falkowski.