CNN  — 

A student was wounded in a shooting Friday morning at a high school in Ocala, Florida, the Marion County Sheriff’s Office said. The incident occurred shortly before students were to walk out as part of a national protest against gun violence.

The 17-year-old Forest High School student, who was shot in the ankle, was in good condition at a hospital with a wound not considered life threatening, officials said.

“I am so glad it was me and not one of my friends,” the boy told sheriff’s deputies at a hospital, according to Sheriff Billy Woods.

“You should be proud of your son,” Woods said of the boy’s parents. “You should be proud because you’ve done something right.”

A school resource officer, Deputy Jimmy Long, heard a loud bang at 8:39 a.m. and rushed to the scene, Woods told reporters.

Three minutes later, the officer took a 19-year-old into custody without resistance, said Woods, describing Long as a hero.

The suspect in the 20th US school shooting this year was identified as Sky Bouche, a former Forest High School student, according to Woods. The motive is unclear.

As Bouche was being escorted out of the sheriff’s headquarters on his way to the county jail, a reporters asked whether he had anything to say.

“Sorry,” he muttered. “It doesn’t make it better, anyway.”

Bouche is charged with terrorism, aggravated assault with a firearm, culpable negligence, carrying a concealed and unlicensed firearm, possessing a firearm on school property, possession of a short-barreled shotgun, interfering with school function and armed trespass on school property.

Earlier, an emotional Woods said he did not want students to be afraid in school.

“It’s a shame what society has come to in that we even have to be here on a school campus,” Woods said. “Society has changed since I was in school. … We as a whole need to do something. My emotions are running rampant.”

‘The hand of God was over our children’

Woods and school officials said the resource officer’s quick response and active shooter protocols at the school helped save lives.

“The hand of God was over our children today,” Marion County School Superintendent Heidi Maier said.

Students at the Ocala, Florida, school used desks, chairs and file cabinets to barricade themselves.

Jake Mailhiot, 16, a junior, posted a photo to social media of desks, chairs and other furniture piled high over the door to the classroom where he was studying psychology. The barricade was meant to keep out an active shooter.

“I didn’t hear anything other than people from other classrooms crying,” he said.

Mailhiot and other students helped a teacher block the door, he said. They were on lockdown for about an hour.

A suspect is in custody after Friday's shooting at Forest High School in Ocala, Florida.

Authorities had asked residents to avoid the campus area, which was surrounded by emergency vehicles and buses transporting students away from the scene.

As Forest High students were being bused to First Baptist Church of Ocala to be reunited with their parents, students at some 2,500 schools around the country were walking out of their classrooms as part of the National School Walkout against gun violence.

“The fact that it happened on this day, in a way, reinforces what we are trying to get across,” said Ryan Servaites, a high school freshman in Parkland, Florida, where 17 students and teachers were gunned down in February. “This happens. It is an issue. We see more people dying. Children are being hurt.”

In a walkout in New York, Stuyvesant High School sophomore Grace Goldstein, 16, lamented that her generation has become desensitized to gun violence.

“We’re very glad that no lives were lost,” she said of the Ocala shooting. “We’re incredibly grateful for that. Our reaction was, of course, this is how our country works. The person who was shot today is on the list of the people who we’re fighting for.”

Forest High was to participate in the walkout, according to a Thursday post on the Ocala school’s Twitter account.

Instead, aerial news footage from the scene showed a sea of students gathered outside a steepled church to meet their parents and officers, guns at their side, clearing buildings on the sprawling Ocala campus.

School walkouts were canceled districtwide in Marion County after the shooting, according to school board member Nancy Stacy.

The Ocala shooting comes more than two months since the massacre at Marjory Stoneman Douglas High School in Parkland near Fort Lauderdale. Parkland students are participating in the national walkout – which is also the 19th anniversary of the shooting deaths of 13 people at Columbine High School in Colorado.

“We won’t stop,” Servaites told CNN. “This is why. It is, in a way, the world slapping us in the face, but we just have to look at it as a wake-up call.”

Forest High, which was ranked as one of the best high schools in the nation by U.S. News & World Report, has about 2,100 students. Ocala is about 65 miles northwest of Orlando.

CORRECTION: This story has been updated to correct Jake Mailhiot’s grade in school.

CNN’s Jamiel Lynch, Dianne Gallagher and Tina Burnside contributed to this report.