One student has been injured and a teenager is in police custody after a shooting at a Florida high school, as students prepare to rally across the country to protest gun violence.

Swat teams were called in to Forest High School after a shooting on Friday morning, when police say a lone gunman opened fire on the Ocala, Florida school. A 17-year-old student suffered non-life-threatening injuries, according to Marion County Sheriff Billy Woods. A 19-year-old suspect, who was not a current student, is in police custody.

Hundreds of state, local, and federal officers responded to the shooting, Mr Woods said. The sheriff's department warned citizens to stay away from the area and told parents to pick up their children in an alternate location.

According to police, the Forest High resource officer heard a loud "bang" at 8:39 am local time. The officer responded to the noise within three minutes, finding the victim and engaging with the shooter. The shooter was taken into custody without resistance.

Mr Woods said the shooting was intentional, but would not say how the suspect got into the school or if he knew the victim.

"Although we have come to a safe conclusion, it is still an investigation," Mr Woods told reporters at a press conference. "And there's a lot of details that we don’t know."

Florida Governor Rick Scott said he had been briefed on the shooting, and offered the county any help necessary.

Students walk out of US schools to protest gun violence Show all 10 1 /10 Students walk out of US schools to protest gun violence Students walk out of US schools to protest gun violence Young people march from the White House to Capitol Hill while participating in the national school walkout over gun violence. EPA Students walk out of US schools to protest gun violence Thousands of local students march down Pennsylvania Avenue from the White House to the US Capitol during a nationwide student walkout for gun control. AFP/Getty Students walk out of US schools to protest gun violence A student has the words,'don't shoot,' written on her hands as she joins with other students at Marjory Stoneman Douglas High School after walking out of their school to honor the memories of 17 students and teachers that were killed. Getty Students walk out of US schools to protest gun violence Students take part in a walkout at General McLane High School. AP Students walk out of US schools to protest gun violence Students from Harvest Collegiate High School stand in Washington Square Park in New York to take part in a national walkout to protest gun violence. AFP/Getty Students walk out of US schools to protest gun violence Students rally in front of the White House in Washington after walking out of school to protest gun violence in the biggest demonstration yet of the student activism that has emerged in response to last month's massacre of 17 people at Florida's Marjory Stoneman Douglas High School. AP Students walk out of US schools to protest gun violence Airport High School juniors Tony LaFata, 16, left, and Noah Doederlein, 17, stands for a moment of silence during a walkout at General McLane High School. AP Students walk out of US schools to protest gun violence Young people rally on the West Front of the US Capitol to participate in the national school walkout over gun violence, in Washington. EPA Students walk out of US schools to protest gun violence Students from Passaic High School hold photos of some of the 17 victims killed at Marjory Stoneman Douglas High School. AP Students walk out of US schools to protest gun violence Students join hands as they take part in a student walkout in Lafayette. AP

The news came as thousands of students around the country prepared to walk out of class to commemorate the 19th anniversary of the Columbine school shooting.

It also came just over two months after the shooting at Marjory Stoneman Douglas High School in Parkland, Florida, where 14 students and three staff members were killed.

Walkouts were cancelled across the Marion County School District in the wake of the shooting, school board member Nancy Stacy told CNN.

Survivor of Florida school shooting speaks at State Capitol rally

Friday's walkouts were planned by Lane Murdock, a high school student from Connecticut who said she was "horrified" by the lack of action after the Parkland shooting. Students from more than 2,500 schools were expected to participate in the walkouts, which participants hoped would spur action on gun control legislation.

Students from Marjory Stoneman Douglas and other schools have planned several demonstrations in the wake of the Parkland shooting, meeting with Florida state lawmakers and even President Donald Trump.

Stoneman Douglas students organised a March For Our Lives in Washington, DC last month, which brought out more than 200,000 to protest gun violence in America.

There have been an average of 10 school shootings per year in the nearly two decades since Columbine, according to data compiled by the Washington Post.

At the press conference on Friday, Mr Woods expressed his frustration with the state of affairs.

"It’s a shame what society has come to, and that we even have to be here on a school campus," he said. "Society has changed since I was a kid; since I was in school."