A gunman opened fire in a Catholic cathedral near Brazil's most populous city, São Paulo, killing five people and wounding several others.
The attack happened towards the end of a midday service in the Metropolitan Cathedral in Campinas city, police say.
The gunman, carrying a revolver and a pistol, rose from his seat and started shooting randomly, Brazil's O Globo News reports.
He then killed himself in front of the altar before police could arrest him.
The motive for the attack is not yet clear. Neither the gunman nor his victims have been identified.
Major Adriano Augusto told O Globo News that the gunman stood up shortly after the prayers had ended.
"He first hit the people on the bench behind him," Major Augusto said. "Apparently he shot in several directions, not directed at anyone specifically."
Most of those who were hit were elderly, the newspaper reports. There is some confusion over the exact number of fatalities, with some reports putting the number at four.
Police officers outside the cathedral immediately entered after hearing the shots. Paramedics could be seen treating people at the scene. Ambulances rushed the wounded to hospital.
The archdiocese of São Paulo said on its Facebook page that the killings had caused "deep pain", and that the cathedral would remain shut while the police investigation was carried out.
Campinas is an industrial city some 100km (62 miles) north-west of São Paulo.