AN orphaned 19-year-old with a troubled past and an AR-15 rifle was charged with 17 counts of premeditated murder yesterday after being questioned for hours by state and US federal authorities following the deadliest school shooting in the country in five years.

Fifteen wounded survivors were taken to hospital as bodies were recovered from inside and around Marjory Stoneman Douglas High School.

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 on Wednesday afternoon shortly before they were to be dismissed, they once again filed out into the hallways.

That was 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 behaviour had caused others to end friendships with him.

Cruz’s mother Lynda Cruz died of pneumonia on November 1, neighbours, friends and family members said, according to reports. Ms 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 did not see this coming. They are co-operating 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 pavements. Students who had not 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 gunman fired, many of the students inside hid under desks or in cupboards, and barricaded doors.

“We were in the corner, away from the windows,” said fresher 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,” Charles 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.

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

An American football coach who also worked as a security guard is among the dead. The football programme at Marjory Stoneman Douglas High School tweeted that assistant coach Aaron Feis died while selflessly shielding students. The tweet ends: “He died a hero and he will forever be in our hearts and memories.”

A law enforcement official said Cruz legally purchased his AR-15 rifle about a year ago.

Federal law allows people 18 and over to legally purchase long guns. At 21, people can legally buy handguns from a legitimate dealer.

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

The attack was reminiscent of the Newtown shootings, which shocked even a country numbed by the regularity of school shootings. The December 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.