At least three people, including a young girl, were killed and 11 wounded when a 16-year-old gunman wearing Nazi symbols opened fire on two schools in south-eastern Brazil on Friday.
Authorities in the city of Aracruz, in Espirito Santo state, said the gunman fired on a group of teachers at his former school, killing two people and leaving nine wounded.
He then left that school — a public primary and secondary school — and went to a nearby private school where he killed a girl and wounded two other people, officials said.
Authorities have arrested the gunman, Espirito Santo Governor Renato Casagrande said.
He declared three days of mourning in the state.
"He was a student at [the first] school until June, a 16-year-old minor. His family then transferred him to another school. We have information he was undergoing psychiatric treatment," Mr Casagrande told a news conference.
He said some people were seriously injured.
"We are rooting and praying for them to recover," he said.
Security camera footage aired on Brazilian media showed the gunman running into the school dressed in military-style camouflage and brandishing a gun. He then sprinted through the hallways, sending staff fleeing in terror as he began firing shots.
Investigators said he had a swastika on his fatigues and that they were looking into whether he had links to any extremist organisations.
Officials said the gunman, a policeman's son, used two handguns in the attack, both registered to his father — one his service firearm, the other a privately registered weapon.
Mr Casagrande said the boy appeared to have planned the attack carefully, breaking in through a locked door and avoiding the school's security guard.
He then entered the teachers' lounge, the first room he came to, and opened fire, the governor said.
"He was looking to shoot people. He opened fire on the first people he came across," he said.
Civil police commissioner Joao Francisco Filho told reporters it appeared the suspect had been planning the attack for two years and that he did not seem to have a "definite target".
Investigators could be seen carrying victims' bodies and loading them into police vehicles outside the school, which was cordoned off with crime scene tape.
Aracruz city has a population of about 100,000 people.
School shootings are relatively rare in Brazil, but have been increasing in recent years.
Brazil's deadliest school shooting left 12 children dead in 2011, when a man opened fire at his former elementary school in the Rio de Janeiro suburb of Realengo, then killed himself.
In 2019, two former students shot dead eight people at a high school in Suzano, outside Sao Paulo, then also took their own lives.
Brazilian president-elect Luiz Inacio Lula da Silva called the latest shootings an "absurd tragedy".
"I was saddened to learn of the attacks," he wrote on Twitter.
"All my solidarity to the victims' families ... and my support to Governor Casagrande for the investigation and assistance to the two school communities."
Mr da Silva, who was previously Brazil's president from 2003 to 2010, will take office on January 1 after defeating far-right President Jair Bolsonaro in elections last month.
He has been sharply critical of Bolsonaro's dramatic relaxation of gun-control laws.
Since ex-army captain Bolsonaro became president in 2019, the number of registered gun owners in Brazil has more than quintupled, from 117,000 to 673,000, boosted by a series of presidential decrees relaxing regulations on firearms and ammunition.
Public security expert Bruno Langeani of research institute Sou da Paz told AFP the outgoing administration's policies had made such attacks more likely.
"The increase in availability of firearms in recent years promoted by the Bolsonaro government facilitates this kind of episode," he said.
The latest attacks spurred calls for gun policy reform.
"Gun policy needs to be reviewed," tweeted senator-elect Wellington Dias, a Lula ally.