A teenage gunman, who injured three people at a South Carolina elementary school before being arrested, carried out the attack after killing his father, local officials said Wednesday.

The teen, whom the authorities did not identify, shot two boys -- one in the leg, the other in the foot -- as well as a teacher in the shoulder at Townville Elementary in the west of the southeastern US state, area officials told reporters.

The attack with a handgun, carried out mid-afternoon, appeared to have occurred on the playground, they said.

"The investigation is in initial stages... it's going to be a very slow, methodical and meticulous investigation," Captain Garland Major of the Anderson County Sheriff's Office said.

An active homicide investigation is underway into the death of Jeffrey DeWitt Osborne, 47, the father of the alleged shooter who lives around two miles (three kilometers) from the school, the Anderson County coroner's office said.

Authorities received a call from the victim's family reporting his death shortly after the school shooting, it said.

The teenage assailant was arrested without incident and has no apparent racial motivation or connections to terrorism, Major told reporters, adding that it was still unclear whether he suffers from mental illness.

The suspect is home-schooled, and does not attend any school in the Anderson County School District, police said.

A firefighter who was one of the first responders on scene contained the teenager, who was "apprehended within a matter of minutes," Joanne Avery, the Anderson County District Four Superintendent told the news conference.

"At approximately 1:45 this afternoon, an individual with a gun entered the premises of Townville Elementary School and injured two of our students and one of our teachers," she said.


Praise for a hero

Lindsey Graham, a Republican senator for the state, praised the heroism of the unarmed volunteer firefighter who stopped the gunman and could have saved lives.

"Thank you to Jamie Brock, the volunteer firefighter who stopped the #Townville shooter. We truly admire and appreciate your service," Graham tweeted.

One of the injured students was airlifted to a local hospital and was undergoing surgery late Wednesday, local media reported, while an ambulance took the other boy and teacher for medical treatment.

One of the boys has since been released from hospital, officials said.

Live images from the school immediately after the shooting showed a large number of police officers and members of the Anderson County Sheriff's Office heavily armed, some wearing helmets and flak jackets.

Students were evacuated on school buses to a nearby church, local media reported.

"The quick response by teachers and staff has kept this from being much worse," superintendent Avery said.

"We are heartbroken about the senseless act of violence."

Fellow South Carolina Senator Tim Scott tweeted that his heart was "sick for Anderson&South Carolina.Praying initial reports of no loss of life remain true & for those injured and their families."

The school has almost 300 students in pre-kindergarten through sixth grade, local media reported. Classes were cancelled for the rest of the week.

School shootings have become a disturbing reality of American life and many facilities have reinforced security in recent years, especially in the wake of the Sandy Hook massacre in 2012, when 26 people -- including 20 young children -- were killed in Newtown, Connecticut.