Twelve people have been killed after a gunman opened fire in a Rio de Janeiro elementary school, Brazilian officials have said.
The gunman was among the dead while another 18 people were wounded in the shooting.
TV images showed more than 100 people gathered outside the Tasso da Silveira school.
The gunman was named as Wellington Menezes de Oliveira, a 24-year-old man who was a former pupil at the school for 1,000 children aged 10 to 15.
Witnesses said the gunman pretended he had been asked to give a speech to students before opening fire with two handguns in a packed classroom.
Local police commander Djalma Beltrame told Globo TV that the shooter left a letter at the scene indicating he wanted to kill himself, but that it did not give a clear motive for the shooting.
Terrified parents rushed to the school and television images showed them crying and screaming for information about their children. TV also showed three helicopters landing on a football field next to the school and then ferrying the wounded to nearby hospitals.
The shooting began about 8.30am local time. Witnesses said police responded quickly and traded fire with the gunman.
It is believed that on his arrival, de Oliveira shot two boys, one in the head and the other in the arm. He then apparently walked into a Portuguese language lesson and opened fire.
School refuse collector Dorival Porto Rafael told the BBC: “Without saying anything he took out a pistol from his bag and started firing. The police arrived, and when he saw he was surrounded, he shot himself in the head.
“He came into the class saying he was going to give a talk. He went to an eighth-grade class, on the ground floor, and without saying anything took out a pistol from his bag and started firing,” said Mr Rafael.
“The police arrived and he tried to go up to the next floor, but when he saw he was surrounded he shot himself in the head,” the eyewitness added.
It is understood that around 400 people were inside the school when the shooting started.
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 ran to the school and at least one located the gunman on the second floor and exchanged fire 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”.