The teenager accused of killing 17 people at a Florida high school on Wednesday has confessed to the shooting, police say.
Nikolas Cruz, 19, said he arrived on campus and began shooting students before abandoning his weapon and escaping, according to a court document.
He has appeared in court charged with 17 counts of premeditated murder.
The FBI has admitted receiving a tip-off about the suspect.
The attack, at Marjory Stoneman Douglas High School in Parkland, Florida, is the deadliest US school shooting since 2012.
“Cruz stated that he was the gunman who entered the school campus armed with a AR-15 and began shooting students that he saw in the hallways and on the school grounds,” according to the court document.
He said he was carrying extra ammunition in a black duffel bag and backpack, it said.
Mr Cruz then discarded his weapon in an attempt to blend in and escape, the documents showed.
He was reportedly able to flee the scene undetected before entering a Walmart and then a McDonalds, and was eventually spotted by police and arrested one hour after the attack.
What do we know about the suspect?
Mr Cruz had been expelled from the school he has confessed to attacking and some students said they had joked “he’s the one to shoot up the school”.
One former schoolmate, Chad Reuters, told Reuters Mr Cruz was an “outcast” who was “crazy about guns”.
His interest in weapons was apparent on his social media profiles, which Broward County Sheriff Scott Israel said were “very, very disturbing”.
Two separate Instagram accounts, now deleted, purport to show Mr Cruz posing with guns and knives.
What were the warnings?
After seeing a comment on a YouTube post last year by Mr Cruz, user Ben Bennight contacted the FBI and spoke to representatives for about 20 minutes.
Mr 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 that school authorities had emailed teachers about Mr Cruz’s behavioural problems.
“There were problems with him last year threatening students, and I guess he was asked to leave campus,” he said.
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”.
Chris Hixon, who was the athletic director at the school, was also confirmed dead by local media. In 2007 Mr Hixon, 49, served as a US Naval Reservist in Iraq.
Teacher Scott Beigel died while trying to lock the door, a student told Good Morning America.
Among the student victims so far identified are:
Alaina Petty, 14
Alex Schachter, 14
Martin Duque, 14
Gina Montalto, 14
Jaime Guttenberg, 17
Luke Hoyer, 15
Alyssa Alhadeff, 15
Carmen Schentrup, 16
Joaquin Oliver, 17
Nicholas Dworet, 18
Meadow Pollack, 18
On Thursday, thousands of people attended a candlelit vigil to honour the victims. There were chants of “no more guns” as speakers demanded tougher gun laws.
What’s the reaction been?
In the wake of the shooting, politicians across the ideological spectrum were quick to offer their condolences. But the conversation soon turned to gun control.
Democrats, many of whom expressed frustration at the levels of gun violence in the US, proposed increased regulation of firearms.
Florida’s Democratic Senator Bill Nelson asked what it would take “for enough to be enough”.
In an emotional interview on CNN, the mother of one of the victims called on President Trump to respond with policy.
“Do something. Action, we need it now. These kids need safety now,” she said.
But many Republicans refused to be drawn into the debate.
In his address to the nation on Thursday, Donald Trump didn’t mention the word “gun” or “firearm” once.
Florida Senator Marco Rubio said that it was too soon to debate whether tighter gun laws could have stopped it.
Texas Senator Ted Cruz accused Democrats of politicising the shooting.
“They immediately start calling that we’ve got to take away the Second Amendment rights of law-abiding citizens. That’s not the right answer,” he told Fox News.