SAO PAULO (AP) — A 14-year-old student opened fire inside a classroom in the central city of Goiania on Friday, killing two classmates and wounding four, police in Brazil said.

Lt. Col. Marcelo Granja of the Goiania police department said the shooting occurred at Colegio Goyases, an upscale private school. The teen was taken into custody.

Granja said the shooter is the son of a police officer who used his father's .40 caliber pistol.

A student who escaped the shooting unhurt told the G1 news portal that the suspect was bullied and called "stinky" because he never used deodorant.

The student said that during a break between lessons the shooter pulled out the gun from inside his backpack and started shooting at random. Everybody started running out of the classroom."

Police inspector Luiz Gonzaga Junior told G1 that a school teacher helped prevent "an even bigger tragedy.

"He had more ammunition," Gonzaga Junior said. "He told us he was planning to kill everyone in the classroom including himself. The teacher approached him and persuaded him to put the gun down."

Witnesses quoted by G1 said there were about 30 students in the classroom at the time of the shooting.

"He told us he knew where his parents kept the gun. He hid it in his backpack and took it to school," Gonzaga Junior said.