Nikolas Cruz, 19, 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.
At least 1,000 people attended a candlelight vigil in Parkland, including Cubs first baseman, Parkland native and Stoneman Douglas alum Anthony Rizzo. He delivered emotional remarks to the crowd.
[Ads /]
"I am only who I am because of this community and I want you to know how proud I am of this community. And I want you to know you are not alone in your grief," Rizzo said. "The entire country is grieving with you."
WATCH: Anthony Rizzo's full remarks at Parkland vigil
Anthony Rizzo speaks at Florida school shooting vigil
"I went to Stoneman Douglas. I grew up at Stoneman Douglas. I played on those fields and went to those classes, the same school we saw on video yesterday for all the wrong reasons," he continued.
Rizzo graduated from Stoneman Douglas in 2007, and donated $150,000 to his alma mater in November to help toward lights for the baseball and softball fields. His parents still live in the area.
"Each name was like my heart skipped a beat," Bryan Herrera said.
The 17-year old soccer player said he initially hadn't planned on attending the vigil. "I didn't think I could handle it," he said.
Dressed in the school's red color, some held flowers while others wielded signs asking for action to fight school violence, including gun control.
At one point during the vigil, some in the crowd began shouting, "No more guns! No more guns!"
Tighe Barry held a yellow sign reading "NRA stop killing our kids."
"I have two kids, and I think the only way it's going to stop is if we get the gun lobbyists off the back of politicians," Barry said.
Seventeen angel statues represented each of the lives lost during the rampage.
Ernest Rospierski, a teacher at the school, took several bracing breaths at the vigil as he talked to a reporter about the horror in the school halls
"Bang, bang, bang - all of a sudden the shooting stopped," he said. "I looked down. He was reloading. I yelled: Run. And then I ran behind as many kids as I could."
Shay Makinde, 16, fought back tears for the friends he tried to save but could not. The junior pulled fleeing students from the hallway into a classroom. He turned to grab Joaquin Oliver but it was too late. The vigil "made me see my friend again and see him get shot and see his body on the floor."
The vigil ended with a request for everyone to write one specific act of good that they would perform in the coming days and weeks as a way to channel the raw emotions of the night into something positive.
"Nikolas Cruz was in my class last year. He was in my first period reading class. He was in my group project. We legit communicated, and I just-I never judge anyone, so I wouldn't think that he would come and shoot up the school and kill my friends," said classmate Tyrah Emans through tears.
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.
WATCH: Sheriff Scott Israel releases timeline of shooting, full list of victims
Broward Count Sheriff reveals timeline of attack, names victims
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."
The 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."
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.
WATCH: Student at Florida school says 'everyone predicted this'
[Ads /]
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.
NIKOLAS CRUZ APPEARS IN COURT
Florida school shooter's first court appearance
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.
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.
The group Everytown for Gun Safety, a nonprofit organization started after the Sandy Hook Elementary School shooting, had previously said there had been 18 school shootings so far this year. That number is included incidents that took place on school grounds but were not related to school activities.
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.
WATCH: Student describes seeing teacher shot
Student speaks about seeing her teacher shot in Florida
Former President Barack Obama tweeted Thursday, "We are grieving with Parkland. But we are not powerless. Caring for our kids is our first job. And until we can honestly say that we're doing enough to keep them safe from harm, including long overdue, common-sense gun safety laws that most Americans want, then we have to change."
SCHOOLS FOCUS ON SAFETY AS THEY BRACE FOR NEXT SHOOTING
Schools focus on safety as they brace for the next school shooting
For a parent, there is little more terrifying than hearing about a gunman opening fire at a school, and for those charged with keeping kids safe in school the Parkland school shooting presents even more challenges.
"We've installed security equipment, spent millions of dollars on security, and yet you get someone who has access to this kind of a weapon," said John Heiderscheidt, director of security of Elgin School District U-46.
Heiderscheidt said all students, teachers and law enforcement participate in lockdown drills at every school, every year. The district Superintendent Tony Sanders posted a letter to staff Thursday saying, "...in the wake of this latest mass shooting, let's not forget the pain. Let it motivate us to lead conversations about how we ensure we never feel this way again."
"We take threats very seriously," Heiderscheidt said. "Whether it's a writing on a bathroom wall or something posted on social media, we're going to investigate that."
[Ads /]
The public defender representing Cruz said he has struggled with significant mental illness and trauma. Psychiatrist Colleen Cicchetti, who runs the psychiatry department at Lurie Children's Hospital, said there are often signs that could warn teachers and social workers of potentially dangerous behavior.
"We have the tools to identify the kids who need help, but the resources to actually meet their needs is what's really problematic," she said.
District U-46, with nearly 40,000 students, is the second largest in the state behind Chicago. They've never had an active shooter situation, but said they are prepared regardless.
CHICAGO CONNECTIONS
The Florida school superintendent helping students and parents through this tragedy used to work in Chicago.
Robert Runcie rose to the ranks of CPS leadership before leaving for Florida to lead the nation's sixth largest school district.
WATCH: Superintendent Robert Runcie speaks about shooting
Broward County Schools Superintendent Robert Runcie
The Cubs said they supported Rizzo's decision to depart spring training for his home in Parkland to offer support in the wake of the deadly shooting.
WATCH: Cubs players speak about deadly school shooting and Anthony Rizzo
Cubs react to Florida school shooting as Rizzo heads to Florida
Rizzo was traveling Thursday, the team said. He had been an early arrival in Arizona, where Chicago's position players are set to report Monday ahead of the club's first full-squad workout. He is expected back by then.
Comfort dogs from Lutheran Church Charities in Northbrook have also been invited to help students, faculty, staff and first responders.
TALKING TO YOUR CHILDREN ABOUT MASS SHOOTINGS
If you are looking for resources on how to talk to you child about the mass shooting in Florida or how to deal with the stress, we recommend the following resources:
Managing your distress in the aftermath of a shooting (American Psychological Association)
How to talk to children about difficult news (American Psychological Association)
Talking to Children About Tragedies (American Academy of Pediatrics)
Explaining the News to Our Kids (Common Sense Media)
Helping Children Cope with Frightening News (Childmind Institute)
Helping Kids After a Shooting (American School Counselor Association)
Helping Children Cope with Terrorism: Tips for Families and Educators (National Association of School Psychologists)
WLS-TV contributed to this report.