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 it received a tip-off about him last year.
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 McDonald's, and was eventually spotted by police and arrested one hour after the attack.