The teenager who allegedly used a shotgun and a revolver to kill 10 people and wound 10 others at a Texas high school Friday admitted he didn't shoot people he liked and meant to kill the ones he did target, a probable cause affidavit says.

Suspect Dimitrios Pagourtzis, 17, has cooperated with police, said Galveston County Magistrate Mark Henry said. Henry denied bail for the student, who is accused of capital murder of multiple people and aggravated assault on a public servant.

Students at Santa Fe High School, not far from Houston in southeastern Texas, scrambled for safety after they heard shots just after class began Friday morning. Nine students and one teacher were killed, a law enforcement official told CNN.

Pagourtzis said little during a video court appearance, answering "Yes, sir" when asked whether he wanted a court-appointed attorney. He was not asked to enter a plea.

The probable cause affidavit says he told an investigator he spared people he liked because he wanted his story told.

The alleged shooter used a shotgun and a .38 revolver that were legally owned by his father, Gov. Greg Abbott told reporters. Two school resource officers were on the campus and confronted the shooter "early on in the process," Abbott said.

Live updates on the school shooting

Latest developments

• A student who survived being shot in the head tweeted: "I'm so greatful and blessed that god spared me today." Rome Shubert showed CNN affiliate KTRK where a bullet went in the back of his head and came out near his left ear.

• A Pakistani exchange student, Sabika Sheikh, was killed, the county's embassy in Washington said.

• One classmate told CNN the alleged shooter was "really quiet and he wore like a trench coat almost every day."

• Abbott said investigators have found journals on a computer and cell phone owned by the suspect.

• The governor offered his sympathies to the victims then called for lawmakers and others to come together to prevent more tragedies. "We need to do more than just pray for the victims and their families. It's time in Texas that we take action to step up and make sure this tragedy is never repeated ever again."

• Retired Houston Police officer John Barnes was one of the people shot at Santa Fe High School, a hospital official said. Houston's police chief tweeted that he visited the hospital where Barnes was being treated and that Barnes was "hanging in there." The officer was working as a Santa Fe officer, a police union official tweeted.

What we know about the shooting

Early morning attack

Gunfire erupted at the school, about 20 miles outside Galveston, not long after classes began around 7:30 a.m. CT, officials said. Authorities later found explosive devices -- including pipe bombs and pressure cookers -- in and near the school, the law enforcement official said.

The suspect is believed to be a student. A second person -- also believed to be a student -- has been detained as well, Harris County Sheriff Ed Gonzalez said earlier.

The male that Gonzalez described as a suspect was injured, a law enforcement official said on condition of anonymity.

Investigators believe that the second person, an 18-year-old, may be an accomplice but not a shooter, a law enforcement official said.

Two law enforcement officers are among the injured, according to a law enforcement source.

One man is in critical condition with a gunshot wound in one of his arms, said David Marshall, chief nursing officer for University of Texas Medical Branch hospital.

This is the 22nd US school shooting since the beginning of the year, and the third instance in eight days in which a gunman was on a school campus.

Witnesses described students running from the school as they heard gunshots; they also described hearing an alarm at the school, though the sequence of events wasn't immediately clear.

Authorities found explosive devices in the high school and in adjacent areas, said Walter Braun, Santa Fe Independent School District police chief. It wasn't immediately clear if any had exploded.

Because the devices were found, Braun urged people in the city of about 13,000 people to "not touch any items that look out of place, and call 911" if they see something suspicious.

Investigators Friday afternoon were searching a trailer where they believe the devices were assembled, a law enforcement source said.

The school has been cleared of all students and staff, who have been directed to a nearby facility to reunite with their families, Braun said.

Witness: Shooter fired gun in an art class

An armed person walked into an art class at the school and began firing what looked like a shotgun, a witness told KTRK.

The witness told KTRK she saw a girl shot in the leg.

Victims were being treated at three hospitals, authorities said. Eight people went to Clear Lake Regional Medical in Webster, Texas; two patients were treated at Mainland Medical Center in Texas City; and four patients went to John Sealy University of Texas Medical Branch in Galveston. It is unclear whether they were all wounded.

Six of the eight patients at Clear Lake Regional were discharged by Friday afternoon.

Witnesses describe hearing an alarm as well as gunfire

Angelica Martinez, a 14-year-old student, told CNN she and her schoolmates were being evacuated at one point "like it's a fire drill."

"We were all standing (outside), but not even five minutes later, we started hearing gunshots," she said. "And then everybody starts running, but, like, the teachers are telling us to stay put, but we're all just running away."

"I didn't see anybody shooting, but like (the gunshots) were kind of spaced," Angelica said, adding she heard about four shots.

A witness who spoke to KTRK also said she heard an alarm. She didn't specify if that was before or after the gunfire she described in the art class.

She said she couldn't describe the shooter.

"I didn't look. I just ran," she said.

Another student, Dakota Shrader, told CNN affiliate KPRC that she heard gunshots only after hearing an alarm in the school.

"I was in the history hallway, and as soon as we heard the alarms, everybody just started leaving following the same procedure as ... (a) practice fire drill," Shrader said, breaking into tears. "And next thing you know, we just hear ... three gunshots, loud explosions, and all the teachers are telling us to run."

MaKenna Evans, a 16-year-old sophomore, told CNN she was in geometry class when the shooting started.

First, she heard a fire alarm, she said. When the students got outside, her principal told them all to run.

Evans said students hid behind a building across the street from the school.

The high school has about 1,400 students, according to GreatSchools.org.

Trump: Mass shootings have been 'going on too long in our country'

Trump addressed the school shooting, saying that mass shootings have been "going on too long."

"Unfortunately, I have to begin by expressing our sadness and heartbreak over the deadly shooting at Santa Fe High School in Texas," Trump said from the East Room of the White House. "This has been going on too long in our country. Too many years. Too many decades now."

Trump said federal authorities are coordinating with local officials.

"We grieve for the terrible loss of life and send our support to everyone affected by this absolutely horrific attack," Trump said.

Trump has ordered US flags at federal facilities be flown at half-staff.

The-CNN-Wire

™ & © 2018 Cable News Network, Inc., a Time Warner Company. All rights reserved.