TIMELINE: Gunman fired into 5 classrooms, went to McDonald's after rampage

PARKLAND, Fla. — A Florida sheriff says the suspect in a high school shooting that killed 17 people fired into five classrooms before dropping his rifle and running away.

Broward County Sheriff Scott Israel says 19-year-old Nikolas Cruz fired into three rooms on the first 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 second 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.

Timeline of deadly school shooting

TIMELINE: The suspect was dropped off at the school at 2:19 p.m. ET. He was taken into custody 1 hour and 22 minutes later. (MORE: 2wsb.tv/2o9iv7n)

Posted by WSB-TV on Thursday, February 15, 2018

Here is the timeline of how the shooting unfolded Wednesday, according to authorities:

2:19 p.m.

Cruz was allegedly dropped off on campus by an Uber driver, around the time students were to be dismissed for the day.

Cruz then entered Building 12 by the east stairwell with a black rifle stashed inside a black, soft case.

He didn't take the weapon out until he exited the staircase, Israel said.

2:21 p.m.

Cruz allegedly readied his rifle before shooting methodically into classrooms 1215, 1216 and 1214. He then went back and shot into rooms 1216, 1215 and 1213.

Cruz then took the west stairwell to the second floor and shot one victim in room 1234, Israel said.

He then took the east stairwell to the third floor, dropped his rifle and backpack, and ran down the stairs before exiting Building 12 and running toward the tennis courts.

From there, Cruz took a southbound turn on foot, crossed a field and ran west, attempting to blend into groups of his former classmates as they fled the scene, "fearing for their lives," Israel said.

Cruz was among the students who gathered at a Walmart near the school, Israel said. There, he purchased a drink at Subway before leaving the Walmart.

3:01 p.m.

Cruz went to McDonald's and sat there for a short period of time before leaving, Israel said.

3:41 p.m.

Cruz was detained without incident, Israel said.

The officer who detained him, Michael Leonard of the Coconut Creek Police Department, said in an earlier news conference Thursday that he spotted someone matching the description of the shooting suspect in a residential neighborhood in Coral Springs, near the school.

Cruz looked like a "typical high school kid," Leonard said.

After he saw him, he "immediately" pulled over his vehicle, and Cruz complied with his orders, he said.

Thursday afternoon

Cruz made a brief court appearance. He was charged with 17 counts of premeditated murder and is being held at the Broward County Jail without bond.

Thursday evening

Hundreds, if not thousands, of people gather in Parkland for a vigil.

Vigil held for victims of Florida school shooting

We're LIVE in Florida where a vigil is being held to remember the 17 people who were killed in a school shooting in South Florida. http://2wsb.tv/2su51IJ

Posted by WSB-TV on Thursday, February 15, 2018

ABC News and The Associated Press contributed to this report.