A gunman opened fire Tuesday in a cathedral in the southeastern Brazilian city of Campinas near Sao Paulo, killing four worshippers before committing suicide as police shot at him, officials said.
Paramedics told reporters the man fired a revolver and a .38-caliber pistol inside the cathedral at 1:00 pm as a sparsely attended mass was taking place, also wounding several people before killing himself.
The motive of the shooting was not immediately known.
Police speaking to the G1 news website identified the gunman as a 49-year-old who resided in Valinhos, a town near Campinas.
"A man opened fire randomly on people inside until police intervened and shot at the gunman who then killed himself," the Security Secretariat for the state of Sao Paulo said in a statement.
In addition to the gunman, four other people died and another four were wounded, it added.
The secretariat said footage from the cathedral's security cameras would be analysed.
News magazine Veja posted footage from one of the cameras inside the cathedral showing the gunman firing a handgun at worshippers as they sat in pews, moving toward his targets as he shot and headed to the altar.
Some survivors were seen running out the door. Two police officers then entered with pistols drawn and moved out of the frame.
"I had started to celebrate mass at 12:15 pm and at the end of the mass, a man entered and shot at his victims. Nobody was able to do anything," priest Amaury Thomazi said in a video published on social media.
Images broadcast on television showed the lifeless body of the gunman, wearing a blue t-shirt, lying inside the cathedral, holding a discharged pistol in his right hand and a revolver tucked into his jeans.
Paramedics treated several people outside the cathedral and there were multiple police cars in the street.
"Everybody ran out. You can imagine that I'm shocked," one woman who was attending the mass told Globo TV.
The archdiocese of Sao Paulo said on its Facebook page that the killings provoked "deep pain" and added that the cathedral would be closed for as long as required for the police investigation.
A police officer told Globo TV that most of those in the cathedral at the time were elderly.
"He opened fire on innocent people. It's a big tragedy," the officer said.
Brazil is one of the most violent countries in the world. Last year, it registered a record 63,880 murders. Its homicide rate of 30.8 per 100,000 inhabitants is three times higher than the level the UN considers to meet the definition of "endemic violence."
Seventy percent of murders in Brazil are committed with firearms, according to the Forum for Public Security monitoring group.
The country's incoming president, Jair Bolsonaro, who takes office on January 1, easily won November elections on a platform that included promises to ruthlessly crack down on crime and ease gun laws to allow "good" people to defend themselves.