US President Donald Trump addressed the nation following the Florida school shooting (AFP Photo/Mandel NGAN)

President Donald Trump vowed Thursday to make mental health a priority after a "disturbed" teenager with a firearms obsession sowed carnage at a Florida high school, while avoiding any mention of gun curbs to stem America's scourge of mass shootings.

Former student named Nikolas Cruz, 19, was to appear before a magistrate later Thursday charged with the premeditated murder of 17 people at Marjory Stoneman Douglas High School in Parkland.

Announcing plans to travel to Florida to meet members of the shocked community, Trump delivered a somber televised address in response to the 18th school shooting to hit the country this year -- a terrifying pattern that US authorities have appeared powerless to stop.

"My fellow Americans, today I speak to a nation in grief," said Trump, calling on his fellow citizens to "come together as one nation" and "answer hate with love, answer cruelty with kindness."

But the president avoided all mention of the politically fraught issue of gun control, vowing instead to "tackle the difficult issue of mental health."

Trump had weighed in on the tragedy earlier Thursday by pointing to "so many signs" the shooter was "mentally disturbed."

"Neighbors and classmates knew he was a big problem. Must always report such instances to authorities, again and again!" he tweeted.

But US authorities were themselves under scrutiny as the FBI confirmed reports it was alerted last year to a message posted on YouTube by a user with Cruz's name, in which he vowed: "I'm going to be a professional school shooter."

In a statement, the FBI said it had investigated, but was unable to confirm the identity of the poster.

Wednesday's harrowing shooting spree saw terrified students hiding in closets and under desks as they texted for help, while the gunman stalked the school with a semi-automatic AR-15 rifle.

Fifteen people were killed at the school itself, and two later died in hospital. One of those killed was Aaron Feis, a well-loved football coach in Parkland, a city of about 30,000 people located north of Miami.

Of the people wounded in the attack, two remained hospitalized in critical but stable condition, while six others were on the way to a full recovery, officials told a news conference.

- 'Failing our kids' -

Expelled for disciplinary reasons, Cruz was reportedly known to have firearms at home and had talked about using them.

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," math teacher Jim Gard said in a Miami Herald interview.

Broward County Sheriff Scott Israel said authorities had "begun to dissect his websites and things on social media that he was on and some of the things... are very, very disturbing."

"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."

The school shootings are part of a broader epidemic of gun violence in a country that loses 33,000 people to gun-related deaths each year.

While the latest mass shooting has reignited questions about America's permissive gun laws, Trump -- who is the first president to have addressed the NRA gun lobby -- is staunchly opposed to any additional gun control.

Opponents of gun curbs have consistently sought to steer public debate away from the issue, and onto the behavior and motives of people using the weapons.

When questioned late Wednesday, Florida Governor Rick Scott -- who described the massacre as "just pure evil" -- similarly declined to make a statement on gun control.

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 Melissa Falkowski, a teacher who squeezed 19 students into a closet at the Parkland high school to shield them from harm.