The FBI was warned about the teenager who allegedly carried out a mass shooting at his former school in Florida, the BBC understands.
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 Mr Cruz, who was not allowed on campus with a backpack, US media report.
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.
After seeing a comment on a YouTube post last year by Mr Cruz, 19, user Ben Bennight contacted the FBI with his concerns. He said he spoke to representatives there for about 20 minutes.
Mr Bennight said that the FBI had contacted him again following the school shooting in Parkland.
The FBI has not yet commented on the reports.
What was the warning to teachers?
Maths teacher Jim Gard told the Miami Herald that school authorities had emailed teachers about Mr Cruz’s behaviour.
“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, and I guess he was asked to leave campus.”
School officials have not disclosed why Mr Cruz was expelled from the school, but student Victoria Olvera, 17, told the Associated Press it was because of a fight with his ex-girlfriend’s new boyfriend.
She also claimed he had been abusive towards the ex-girlfriend.
Former schoolmate Joshua Charo said Mr Cruz had been found with bullets in his backpack.
“I can’t say I was shocked,” Mr Charo said.
“He seemed like the kind of kid who would do something like this.”
Some other students echoed that opinion when interviewed.
“Everyone predicted it,” one told WFOR-TV.
But police said they were not warned of any possible attack by Mr Cruz.
Superintendent Robert Runcie told reporters: “We received no warnings.
“Potentially there could have been signs out there. But we didn’t have any warning or phone calls or threats that were made.”
According to reports Mr Cruz told the family he was staying with that he did not want to go to college because it was Valentine’s Day.
What happened at the school?
Reports suggest that a fire alarm at Marjory Stoneman Douglas High School in Parkland, Florida, was deliberately set off at 14:30 local time (19:30 GMT).
The alarm caused some students and staff to leave their classrooms.
Witnesses said that the gunman was deploying smoke grenades and wearing a gas mask.
Students told US media they hid under desks or in store cupboards or barricaded doors as loud shots rang out.
‘There may be no answer’
By Owen Amos, BBC News
At first, it seems like a normal day in Parkland, Florida. The sky is blue. The palm trees are green. And the temperature is rising.
But, 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 high 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; today, the temperature was 25C by 09.30 local time.
He was playing golf when he heard the news. “I just love South Florida,” he says, adding: “This is supposed to be paradise.”
Lanny, a semi-retired broadcaster, 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.”
A teacher told WSVN that she hid in a closet with 19 students for 40 minutes – and that the school underwent training for such a situation six weeks ago.
Caesar Figueroa, a parent, told CBS News his daughter was hiding in a closet when she called him.
He told the news outlet that he told her not to call him because he did not want the gunman to hear her voice.
“It’s the worst nightmare not hearing from my daughter for 20 minutes, it was the longest 20 minutes of my life,” Mr Figeuroa said.
Police and Swat team members swarmed the campus and began clearing students from the school, as parents and ambulances converged on the scene.
Mr Cruz apparently left the scene of the shooting by blending in with fleeing students, but was arrested several miles away and is now in police custody.
He was detained in the nearby town of Coral Springs. He was then treated in hospital and taken into police custody.
Who were the victims?
Details of the 17 victims are emerging as they are identified.
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”.
What else do we know about the suspect?
Broward County Sheriff Scott Israeli said Mr Cruz’s social media profiles were “very, very disturbing”.
Two separate Instagram accounts, now deleted, purport to show Mr Cruz posing with guns and knives.
Mr Cruz had been staying with a local family in recent months, following his adopted mother’s death in November.
He allegedly used an AR-15 rifle in the attack, which he had bought legally and which he kept locked up in their house at their request.
The family’s lawyer, Jim Lewis, said: “They are heartbroken. The kid that lives here goes to that school and knows many of these kids. He is just as heartbroken and shocked as everyone else.”
What’s the reaction been?
President Donald Trump 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.
“There’s a time to continue to have these conversations about how through law enforcement… we make sure people are safe,” he said.
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”.