A man visits a makeshift memorial Friday of twelve crosses representing each child killed the day before in a school shootout in Rio de Janeiro, Brazil. (Victor R. Caivano/Associated Press)

Grieving families gathered Friday to bury 12 children gunned down in the halls of their elementary school, an unheard-of act of school violence left stunned Brazilians struggling for answers.

Ten girls and two boys between the ages of 12 and 15 were gunned down, most shot in the head at point-blank range by 23-year-old Wellington Oliveira, who shot and killed himself after being confronted by police.

At least 12 other students were injured in the Thursday shooting at the Tasso da Silveira public school. Two are in grave condition.

Neighbours wandered past the school in a shocked daze Friday, leaving flowers along the wall of the school in western Rio's working-class Realengo neighbourhood. Twelve crosses were left along a wall just outside the school, the name of each child killed written on white pieces of paper above them.

Officials posted the schedule for 12 funerals on the school gate. On a blackboard in the schoolyard, teachers left messages imploring for better security in Brazil's schools. One read, "The Carioca family is in mourning" — Carioca being the nickname for natives of Rio.

Brazilian tradition stipulates that people be buried the day after their death, and President Dilma Rousseff was expected to arrive in Rio to attend some of the funerals.

The shootings turned the school, which was celebrating its 40th anniversary Thursday, into a nightmarish scene, with bullet holes and blood marking the walls of classrooms.

Witnesses said the gunman stalked the halls of the elementary school he attended himself years before, lining up most of the children he killed and shooting them in the head, one after another, as they begged for him to stop.

Oliveira took his own life after police gunfire struck his legs and sent him toppling down some stairs, but not before carrying out what crime experts said was the worst school massacre in Brazil's history.