CHICAGO (CBS) — A 19-year-old man who had been expelled from a high school in Parkland, Florida, has confessed to carrying out one of the deadliest school shootings in U.S. history, authorities said.

Nikolas Cruz, formally charged now with 17 murder counts, allegedly opened fire with an assault rifle inside Marjory Stoneman Douglas High School on Wednesday, killing 17 people and wounding 15 others. Investigators believe he pulled the fire alarm, causing chaos, and then started shooting. Police said he was equipped with a gas mask, smoke grenades, and multiple magazines of ammunition.

At a brief court appearance on Thursday afternoon, Cruz was ordered held without bond.

Hundreds of students and teachers scrambled at the first sound of gunfire.

“Kids were freaking out. Some froze, some were on their phones — a lot were on their phones just trying to Snapchat everything because they thought it was a joke and it wasn’t,” said one former student, who happened to be at the school visiting a teacher.

Cruz reportedly changed his clothes and evacuated with the other students. He was arrested a short time later in a nearby neighborhood in Coral Springs. Cruz exhibited labored breathing, and was taken to the hospital as a precaution.

He arrived at the Broward County Jail early Thursday, still dressed in his hospital gown.

Only one of the victims has been identified. Students and parents said football coach Aaron Feis might have acted as a human shield to protect some students.

Cruz had attended Stoneman Douglas, but was expelled last year, according to the Broward Sheriff’s Office. The teen reportedly had threatened students at the school, and was barred from campus.

The school will remain closed on Thursday and Friday.

Authorities offered no immediate details about Cruz or his possible motive, except to say he’d 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.

Many of Cruz’s posts on social media are gun and violence related. On Instagram, he posted a photo of himself with a shotgun. In another photo, he is seen with a pistol, which appears to be a type of BB gun. Other pictures show him holding long knives. Broward Sheriff Scott Israel described the posts as “disturbing.”