Nikolas Cruz told investigators that he shot students in the hallways and on the grounds of Marjory Stoneman Douglas High School in Parkland, north of Miami, the report from the Broward County Sheriff's Office said.
Cruz said he brought more loaded magazines to the school and kept them in the backpack until he got to campus.
As the gunman moved through the school, he fired into five classrooms - four on the first floor and one on the second floor, Sheriff Scott Israel said.
The shooting lasted for three minutes. The assailant then went to the third floor and dropped his AR-15 rifle and the backpack and ran out of the building, attempting to blend in with fleeing students, Israel said.
After the rampage, the suspect headed to a Wal-Mart and bought a drink at a Subway restaurant before walking to a McDonald's. He was taken into custody about 40 minutes after leaving the McDonald's, the sheriff said.
A day after the attack, a fuller portrait emerged of the shooter, a loner who had worked at a dollar store, joined the school's ROTC program and posted photos of weapons on Instagram. At least one student said classmates joked that Cruz would "be the one to shoot up the school."
PHOTOS: School shooting in Parkland, Fla.
The 19-year-old orphan whose mother died last year was charged with murder Thursday in the assault that devastated this sleepy community on the edge of the Everglades. It was the nation's deadliest school attack since a gunman targeted an elementary school in Newtown, Connecticut, more than five years ago.
Meanwhile, students struggled to describe the violence that ripped through their classrooms just before the school day ended.
Catarina Linden, a 16-year-old sophomore, said she was in an advanced math class Wednesday when the gunfire began.
"He shot the girl next to me," she said, adding that when she finally was able to leave the classroom, the air was foggy with gun smoke. "I stepped on so many shell casings. There were bodies on the ground, and there was blood everywhere."
Gunshots heard inside school. WARNING - SOME MAY FIND DISTURBING
State Sen. Bill Galvano visited the high school Thursday and was allowed to go up to the third floor, where he was shown bullet holes that marked where Cruz had tried to shoot out the windows at point-blank range. But the high-impact glass did not shatter.
Authorities told Galvano that Cruz apparently wanted to shoot out the windows so he could fire on the students running away from the school. Police told Galvano that it was not that difficult to open the windows.
"Thank God he didn't," Galvano said.
Among the dead were a football coach who also worked as a security guard, a senior who planned to attend Lynn University and an athletic director who was active in his Roman Catholic church.
The last of the bodies were removed from the high school Thursday after authorities analyzed the crime scene. Thirteen wounded survivors were still hospitalized, including two in critical condition.
Authorities have not offered any specific motive, except to say that Cruz had been kicked out of the high school, which has about 3,000 students and serves an affluent suburb where the median home price is nearly $600,000. Students who knew him described a volatile teenager whose strange behavior had caused others to end friendships with him.
Cruz was ordered held without bond at a brief court hearing. He wore an orange jumpsuit with his hands cuffed at his waist. His attorney had her arm around Cruz during the short appearance. Afterward, she called him a "broken human being."
He was being held under a suicide watch, Executive Chief Public Defender Gordon Weekes told reporters.
PHOTO: Arrest of Nikolas Cruz
Wednesday's shooting was the 17th incident of gunfire at an American school this year. Of the 17 incidents, one involved a suicide, two involved active shooters who killed students, two involved people killed in arguments and three involved people who were shot but survived. Nine involved no injuries at all.
As the criminal case began to take shape, President Donald Trump, in an address to the nation, promised to "tackle the difficult issue of mental health," but avoided any mention of guns. Trump, who owns a private club in Palm Beach, about 40 miles from Parkland, said he planned to visit the grieving community.
He did not answer shouted questions about guns as he left the room.
Trump, who did not speak publicly immediately after the shooting, weighed in on Twitter early Thursday, calling the suspect "mentally disturbed" and stressing that it was important to "report such instances to authorities, again and again!"
In the case of Cruz, at least one person did report him.
FBI agent Rob Lasky said the FBI investigated a 2017 YouTube comment that said "I'm going to be a professional school shooter." But the agency could not identify the person who made the comment, which was from an account using the name Nikolas Cruz. It was left on a YouTube video of a vlogger and bail bondsman from Louisiana named Ben Bennight.
In a Buzzfeed article , Bennight said he called the FBI, and agents came out to talk with him. They called him again Wednesday.
Officials were also investigating whether authorities missed other warning signs about Cruz's potentially violent nature.
He had been expelled from the school for "disciplinary reasons," according to the sheriff, who said he did not know the specifics.
One student said Cruz had been abusive to his ex-girlfriend and that his expulsion was over a fight with her new boyfriend.
Math teacher Jim Gard told the Miami Herald that Cruz may have been identified as a potential threat before Wednesday's attack. Gard believes the school had sent out an email warning teachers that Cruz should not be allowed on campus with a backpack.
The leader of a white nationalist militia called the Republic of Florida said Cruz was a member of his group and had participated in exercises in Tallahassee. Jordan Jereb said he had only a brief interaction with Cruz a few years ago. The group wants Florida to become its own white ethno-state.
Neither the Leon County Sheriff's Office in Tallahassee nor the Southern Poverty Law Center could confirm any link between Cruz and the militia.
Jereb appeared to back away from his claim later Thursday. Someone posting under his name on Gab, a social media site popular with far-right extremists, complained about getting criticized over a "prank," claimed there was a "misunderstanding" and said he received "a bunch of conflicting information."
Cruz's mother, Lynda Cruz, died of pneumonia Nov. 1, and his father died previously, according to the arrest affidavit.
Two federal law enforcement officials said the Smith & Wesson M&P 15 .223 was purchased legally last year at Sunrise Tactical Gear in Florida.
Send a News Tip to Action News
Report a Correction or Typo
Learn More About 6abc Apps