A gunman opened fire at a public elementary school in Rio de Janeiro on Thursday, killing at least 11 students before taking his own life.
At least 18 other people, mostly students, were hurt and brought to local hospitals, said Rio state Health Secretary Sergio Cortes. At least four were in a serious condition.
The dead included 10 girls and one boy, plus the gunman, Mr Cortes said. The ages of the children were not immediately known. Police had said earlier that at least 13 people had died in the shooting.
A police spokeswoman identified the gunman as 23-year-old Wellington Oliveira, a former student at the Tasso da Silveira school, located in a working-class neighbourhood in western Rio.
A motive was not immediately known, but authorities said the gunman left a rambling and mostly incoherent letter at the scene indicating he wanted to kill himself.
Rio is a city rife with drug-gang violence in its vast slums, but school shootings are rare. The gunman had no criminal history, Police Chief Martha Rocha told a news conference.
Chief Rocha said he walked into the school with two firearms - she didn't detail what type - and an ammunition belt. He fired off at least 30 rounds.
About 400 people were inside the school when the shooting began about 8:30 a.m. local time.
Two young boys, at least one with a gunshot wound, ran up to two police officers on patrol about two blocks away from the school as the shooting started.
The two officers sprinted to the school and at least one quickly located the gunman on the second floor and traded shots with him.
"He saw me and aimed a gun at me," said officer Marcio Alves. "I shot him in the legs, he fell down the stairs and then shot himself in the head."
Rio Mayor Eduardo Paes said life at the four-story, pastel-yellow and green school was turned into a "hellish nightmare."
"This day would have been so much worse if it weren't for the hero policeman," Mr Paes told reporters at the school.
Authorities closed the school temporarily while they investigate, but Mr Paes said it would reopen.
Rio Governor Sergio Cabral called the shooter a "psychopath." He said there were no indications yet that anyone else was involved in the shooting, but that the investigation would continue.
"We have to investigate where he got the weapons and where he learned to use them," the governor said.
Terrified parents rushed to the school in the Realengo neighborhood. Television images showed them crying and screaming for information about their children.
Brazilian President Dilma Rousseff, attending an event in the capital, Brasilia, lamented the deaths of "defenceless children."
"I ask for one minute of silence for these children who were taken so early from their life," she said, her voice cracking and eyes welling with tears. "It's not in the nature of our nation to have these types of crimes."