(AP Photo/Joel Auerbach) A woman consoles another as parents wait for news regarding a shooting at Marjory Stoneman Douglas High School in Parkland, Fla., Wednesday, Feb. 14, 2018.

Parents wait for news after a reports of a shooting at Marjory Stoneman Douglas High School in Parkland, Fla., on Wednesday, Feb. 14, 2018. (AP Photo/Joel Auerbach)

(AP Photo/Wilfredo Lee) Students wait to be picked up after a shooting at Marjory Stoneman Douglas High School in Parkland, Fla., Wednesday, Feb. 14, 2018.

Family members embrace following a shooting at Marjory Stoneman Douglas High School, Wednesday, Feb. 14, 2018, in Parkland, Fla. (AP Photo/Wilfredo Lee)

(AP/Meredith) – An orphaned 19-year-old with a troubled past and an AR-15 rifle has been charged with 17 counts of premeditated murder after being questioned for hours by state and federal authorities following the deadliest school shooting in the U.S. in five years.

On Thursday, Nikolas Cruz confessed to being the shooter at Marjory Stoneman Douglas High School, according to a report from the Broward County Sheriff's Office.

He told interrogating officers that he "began shooting students that he saw in the hallways and on school grounds" on Wednesday afternoon.

The report adds that Cruz told officers he "brought additional loaded magazines to the school campus and kept them hidden in a backpack until he got on campus to begin his assault."

Cruz told investigators that as students began to flee, he decided to discard his AR-15 rifle and a vest he was wearing so he could blend in with the crowd. Police recovered the rifle and the vest.

A Florida sheriff says the suspect fired into five classrooms before dropping his rifle and fleeing on foot.

Broward County Sheriff Scott Israel says Cruz fired into three rooms on the second floor of the school in Parkland, then went back and fired again into two of those rooms. He says the shooter fired into one other room on that floor before moving to the third floor and shooting one person in a classroom there.

The sheriff says the gunman then dropped his rifle and backpack containing extra ammunition and ran out of the school. As he crossed fields, he tried to blend in with fleeing students.

The police report adds that Cruz purchased the rifle in February 2017, but does not say where it was purchased.

Scott spoke during a press conference on Thursday, a day after a shooting left 17 people dead at a high school. He said leaders will look at how they can make sure something like that never happens again.

During the conference, FBI agent Rob Lasky says the FBI investigated a 2017 YouTube comment that said "I'm going to be a professional school shooter"; but the agency couldn't identify the person making the comment.

What we know about the shooting

Just before the shooting broke out, some students thought they were having another fire drill.

Such an exercise had forced them to leave their classrooms hours earlier. So when the alarm went off Wednesday afternoon shortly before they were to be dismissed, they once again filed out into the hallways.

That's when police say Nikolas Cruz, equipped with a gas mask, smoke grenades and multiple magazines of ammunition, opened fire with a semi-automatic weapon, killing 17 people and sending hundreds of students fleeing into the streets.

It was the nation's deadliest school shooting since a gunman attacked an elementary school in Newtown, Connecticut, more than five years ago.

"Our district is in a tremendous state of grief and sorrow," said Robert Runcie, superintendent of the school district in Parkland, about an hour's drive north of Miami. "It is a horrible day for us."

Authorities offered no immediate details about Cruz or his possible motive, except to say that he had been kicked out of the high school, which has about 3,000 students. Students who knew him described a volatile teenager whose strange behavior had caused others to end friendships with him.

Cruz's mother Lynda Cruz died of pneumonia on Nov. 1 neighbors, friends and family members said, according to the Sun Sentinel . Cruz and her husband, who died of a heart attack several years ago, adopted Nikolas and his biological brother, Zachary, after the couple moved from Long Island in New York to Broward County.

The boys were left in the care of a family friend after their mother died, family member Barbara Kumbatovich, of Long Island, said.

Unhappy there, Nikolas Cruz asked to move in with a friend's family in northwest Broward. The family agreed and Cruz moved in around Thanksgiving. According to the family's lawyer, who did not identify them, they knew that Cruz owned the AR-15 but made him keep it locked up in a cabinet. He did have the key, however.

Jim Lewis said the family is devastated and didn't see this coming. They are cooperating with authorities, he said.

Victoria Olvera, a 17-year-old junior at the school, said Cruz was expelled last school year because he got into a fight with his ex-girlfriend's new boyfriend. She said he had been abusive to his girlfriend.

"I think everyone had in their minds if anybody was going to do it, it was going to be him," she said.

Cruz was taken into custody without a fight about an hour after the shooting in a residential neighborhood about a mile away. He had multiple magazines of ammunition, authorities said.

"It's catastrophic. There really are no words," said Broward County Sheriff Scott Israel.

Frantic parents rushed to the school to find SWAT team members and ambulances surrounding the huge campus and emergency workers who appeared to be treating the wounded on sidewalks. Students who hadn't run began leaving in a single-file line with their hands over their heads as officers urged them to evacuate quickly.

Hearing loud bangs as the shooter fired, many of the students inside hid under desks or in closets, and barricaded doors.

"We were in the corner, away from the windows," said freshman Max Charles, who said he heard five gunshots. "The teacher locked the door and turned off the light. I thought maybe I could die or something."

As he was leaving the building, he saw four dead students and one dead teacher. He said he was relieved when he finally found his mother.

"I was happy that I was alive," Max said. "She was crying when she saw me."

Noah Parness, a 17-year-old junior, said he and the other students calmly went outside to their fire-drill areas when he suddenly heard popping sounds.

"We saw a bunch of teachers running down the stairway, and then everybody shifted and broke into a sprint," Parness said. "I hopped a fence."

Most of the fatalities were inside the building, though some victims were found fatally shot outside, the sheriff said.

Sen. Bill Nelson told CNN that Cruz had pulled the fire alarm "so the kids would come pouring out of the classrooms into the hall."

"And there the carnage began," said Nelson, who said he was briefed by the FBI.

The scene was reminiscent of the Newtown attack, which shocked even a country numbed by the regularity of school shootings. The Dec. 14, 2012, assault at Sandy Hook Elementary School killed 26 people: 20 first-graders and six staff members. The 20-year-old gunman, who also fatally shot his mother in her bed, then killed himself.

Not long after Wednesday's attack in Florida, Michael Nembhard was sitting in his garage on a cul-de-sac when he saw a young man in a burgundy shirt walking down the street. In an instant, a police cruiser pulled up, and officers jumped out with guns drawn.

"All I heard was 'Get on the ground! Get on the ground!'" Nembhard said. He said Cruz did as he was told.

The school was to be closed for the rest of the week.

President Trump’s response

President Donald Trump said the nation is "joined together as one American family" after a shooting at a Florida high school that killed 17 people.

In a national address from the White House on Thursday, Trump said he wanted to speak directly to America's children, saying "you are never alone, and you never will be."

He said no child should have to go to school fearing for their lives. Trump said he'll travel to Florida meet with victims' families, explore how to better secure schools and "tackle the difficult issue of mental health."

He did not mention guns or gun control.

Kentucky Gov. Matt Bevin

Kentucky's Republican governor says he's heartbroken over the Florida school shooting, especially since his state is still recovering from a similar shooting at a high school in Kentucky just a few weeks ago.

Gov. Matt Bevin told talk radio hosts his heart is truly broken for the people of Florida and the community has been shattered in a similar way that Kentucky was in January.

He said guns are not the reason for increase in school shootings, but blamed a culture that delegitimizes life through violent video games, TV shows and music lyrics.

Bevin called video games where people kill others "garbage" and said "it's the same as pornography." He said "freedom of speech" has been abused by allowing things that are "filthy and disgusting and have no redeemable value."

Superintendent Robert Runcie

A school district superintendent choked up during a television interview while discussing the shooting.

Broward County school district Superintendent Robert Runcie told WSVN on Thursday morning that seeing the bodies strewn on floors inside Marjory Stoneman Douglas High School "was absolutely horrific."

A tearful Runcie said the scene was "nothing like I've ever seen in my entire life." Runcie said his thoughts are with the parents and families whose children didn't come home from school Wednesday.

Candlelight Vigil

At least 1,000 people attended a candlelight vigil Thursday night for the 17 people killed in a Florida school shooting, some of the mourners sobbing openly as the victims' names were read aloud.

"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.

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

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.