The city of Parkland in Florida, where at least 17 people were killed following a mass shooting at a school, was ranked one of the safest places in the US to raise a family just two days before the massacre.

Former student Nikolas Cruz is accused of committing the atrocity at Marjory Stoneman Douglas High School on the afternoon of 14 February.

The attack, which involved the use of a semi-automatic AR-15 rifle, was the nation's deadliest school shooting since the attack at Sandy Hook in Newton, Connecticut in 2012 and among the top 10 deadliest mass shootings in modern US history.

Just two days before the attack took place, a study from US real estate website Neighborhood Scout ranked the city of Parkland as the 15th safest in the US.

The study, based on cities with 25,000 or more people, ranked areas based on the total number of property and violent crimes per 1,000 residents.

According to the study, Parkland is statistically safer than 85% of US cities, with only 19 violent crimes occurring in 2016, a crime rate of 0.6 per 1,000 residents. Parkland the second safest city in the state of Florida after Weston in 8th place, followed by Oviedo in 97th place.

Elsewhere, a description on Neighborhood Scout's website of Parkland describes how its "overall crime rate ranks among the lowest in the country, making it one of the safest places to raise a family".

Following the attack, Students at Marjory Stoneman Douglas High School have described their fear at witnessing Cruz, kitted out with gas mask, smoke grenades and multiple magazines of ammunition, indiscriminately opening fire after walking into the school.

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, adding "and there the carnage began."

florida shooting
Pupils are brought out of the Marjory Stoneman Douglas High School after the shooting which killed 17 Getty

Authorities have not suggested a possible motive for the shooting, but further details have emerged of the 19-year-old suspect who was expelled from the school for disciplinary reasons.

Victoria Olvera, a 17-year-old junior at the school, said Cruz was thrown out of the school when he got into a fight with his ex-girlfriend's new boyfriend. Olvera added Cruz was known to be abusive to his girlfriend.

Fellow pupil Dakota Mutchler added: "He started progressively getting a little more weird. He started going after one of my friends, threatening her, and I cut him off from there.

She added: "I think everyone had in their minds if anybody was going to do it, it was going to be him," she said.

Broward County Sheriff Scott Israel also said officers are examining the suspect's "very, very disturbing" social media, believed to include photos of him posing with guns and killing animals.

According to maths teacher Jim Gard, Crux had been banned from returning to the school campus while carrying a backpack.

He told the Miami Herald Cruz: "There were problems with him last year threatening students, and I guess he was asked to leave campus."

Robert Runcie, superintendent of the school district in Parkland, said: "Our district is in a tremendous state of grief and sorrow. It is a horrible day for us."

Stoneman school shooting
Police escort a suspect into the Broward Jail after checking him at the hospital following a shooting incident at Marjory Stoneman Douglas High School WSVN.com via REUTERS

This article has been amended to state that Parkland is listed as the second safest city in Florida, not the first.