Sheriff says gunman is a former student who fellow colleagues describe as 'troubled'.
Authorities in Florida could offer no explanation on Wednesday night as to why a former student opened fire at a high school earlier that day.
The former learner was armed with an AR-15 rifle, killing at least 17 people.
Broward County Sheriff Scott Israel identified the gunman as Nikolas Cruz, 19, a former student at Marjory Stoneman Douglas High School in Parkland who had been expelled for 'disciplinary reasons', but was currently enrolled in Broward County Public Schools.
Cruz, whose fellow students described him as 'troubled', was arrested without incident in the nearby town of Coral Springs after the Valentine's Day rampage and taken to hospital with minor injuries, the sheriff said.
He had mixed in with students fleeing the school before being caught, officials said.
"We have already begun to dissect his websites and things on social media that he was on and some of the things... are very, very disturbing," Israel said.
"If a person is predisposed to commit such a horrific event by going to a school and shooting people ... there's not anybody or not a lot law enforcement can do about it."
Israel said both students and adults had been killed, 12 of whom had been identified.
Fifteen people were killed at the school itself and 17 were taken to hospital, two of whom died of their wounds, the sheriff's office said. One of those killed was a football coach and one student injured was a deputy sheriff's son.
"This is a terrible day for Parkland," Israel said, speaking of the city of about 30,000 people, located 50 miles (80 kilometres) north of Miami.
A teacher at the school said Cruz had been identified previously as a potential threat to his classmates.
"We were told last year that he wasn't allowed on campus with a backpack on him," math teacher Jim Gard said in a Miami Herald interview.
"There were problems with him last year threatening students, and I guess he was asked to leave campus."
Cruz was also said to have been in the Junior ROTC (Reserve Officers' Training Corps) programme while at school.
A law enforcement source told CBS News that the gunman pulled a fire alarm before opening fire, but Israel could not confirm that report.
The shooting, one of nearly 20 at a school since the start of the year, will once again throw the spotlight on the epidemic of gun violence in the United States, where there are 33,000 gun-related deaths annually.
But when questioned at a press conference, Florida Governor Rick Scott declined to make a statement on gun control after the shooting.