The FBI has confirmed that it was warned about the teenager who allegedly carried out a mass shooting at his former school in Florida.
Nikolas Cruz, who has been charged with 17 counts of premeditated murder, reportedly left a comment on a YouTube video last year stating: "I'm going to be a professional school shooter."
A user alerted authorities to the post.
Teachers were also warned about Cruz, who was not allowed on campus with a backpack, US media report.
The FBI said it had investigated the YouTube comment but had been unable to fully identify the person who posted it.
Seventeen people were killed and many more were injured in the attack at Marjory Stoneman Douglas High School in Parkland, Florida. Several people are in a critical condition.
It is the deadliest shooting at a US school since 2012.
Expressing his condolences on Thursday, US President Donald Trump said he was "making plans to visit" Parkland.
What were the warnings?
After seeing a comment on a YouTube post last year by Cruz, 19, user Ben Bennight contacted the FBI and spoke to representatives for about 20 minutes.
Bennight said the FBI contacted him again following the school shooting in Parkland.
The FBI confirmed on Thursday that they were made aware of the comment, adding that they had conducted "checks" but were unable to identify the person behind it.
Meanwhile maths teacher Jim Gard told the Miami Herald newspaper that school authorities had emailed teachers about Cruz's behaviour.
"We were told last year that he wasn't allowed on campus with a backpack on him," Gard told the Miami Herald.
"There were problems with him last year threatening students, and I guess he was asked to leave campus."
It is unclear why Cruz was expelled from the school. Former schoolmate Joshua Charo said Cruz had been found with bullets in his backpack.
"I can't say I was shocked," Charo said after the shooting.
"He seemed like the kind of kid who would do something like this."
Other students echoed that opinion. "Everyone predicted it," one told local station WFOR.
But police said they were had not been warned of a possible attack by Cruz.
Who were the victims?
Details of the 17 victims are emerging.
The school's assistant football coach Aaron Feis was taken to hospital after jumping in front of students to shield them from bullets. His team tweeted that he had "died a hero".
The family of student Jaime Guttenberg confirmed her death in a Facebook post on Thursday, referring to the 17-year-old as an "awesome young girl" and updating her page on the social media site to create a memorial for her.
Guttenberg's parents earlier said that her brother Jesse had escaped unharmed.
Another student, Alyssa Alhadeff, has been identified by her family as a victim of Wednesday's shooting.
A fourth victim, Nicholas Dworet, was confirmed dead on social media by members of his swimming team.
'There may be no answer'
On approaching Stoneman Douglas High, it is clear that nothing is normal about today.
The yellow school buses are parked up, going nowhere. The soccer fields are empty. TV trucks line the neat verges.
While the school is closed, the nearby elementary school is open. Parents hold their children's hands tightly as they dodge cameramen.
Lanny James, 77, has a place five miles away in Margate. He comes here for the sun. He was playing golf when he heard the news. "This is supposed to be paradise," he says.
Lanny has 10 guns and has hunted since the 1960s. "I just don't know what the answer is," he says. "And there may not be one."
What else do we know about the suspect?
Broward County Sheriff Scott Israel said Cruz's social media profiles were "very, very disturbing".
Two separate Instagram accounts, now deleted, purport to show Cruz posing with guns and knives.
Cruz allegedly used an AR-15 rifle in the attack, which he had reportedly bought legally.
US media report that Cruz has links with a white supremacist group called the Republic of Florida.
What's the reaction been?
Speaking at the White House on Thursday, Trump addressed "every parent, teacher and child who is hurting", and said authorities would do "whatever we can to ease your pain".
"I want you to know that you are never alone," the president said, adding: "No child should be in danger in an American school."
He added: "We are committed to working with local leaders to tackle the difficult issue of mental health.".
Trump earlier said the shooting showed that people must report their concerns about others' erratic behaviour.
Florida Senator Marco Rubio tweeted that the shooting was "designed and executed to maximize loss of life".
But he said that it was too soon to debate whether tighter gun laws could have stopped it.
"You should know the facts of that incident before you run out and prescribe some law that you claim could have prevented it," he told Fox News.
Florida Governor Rick Scott said the shooting was "pure evil", but also refused to be drawn into a discussion about gun control.
Florida's Democratic Senator Bill Nelson asked what it would take "for enough to be enough".
"Sandy Hook, Pulse nightclub, [Fort] Lauderdale airport, Las Vegas and now Parkland, Florida - when is this going to stop?" he wrote on Twitter.
Democratic Senator Chris Murphy tweeted that it was time to debate gun violence, adding that political leaders needed to act to prevent "this slaughter".