At least four people were killed and four others wounded after a gunman opened fire in a cathedral in the southeastern Brazilian city of Campinas on Tuesday, Reuters reported. The assailant then killed himself after security forces wounded him, said authorities.

Police identified the shooter as Euler Fernando Gandolfo, a 49-year-old systems analyst with no previous criminal record. Campinas police chief Jose Henrique Ventura said the injured were taken to a hospital and were reportedly out of danger.

The incident took place at 1 pm local time (8.30 pm Indian time). Gandolfo was carrying a revolver and a .38-caliber pistol, AFP reported. “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.

Ventura said security cameras showed Gandolfo enter the cathedral and sit down among worshippers who stayed behind to pray after midday mass. A while later, started shooting at people. Ventura said police officials stationed in the plaza outside rushed into the cathedral after hearing the gunshots.

Gandolfo then ran to the altar while firing at police and was hit in the side. Ventura said the gunman fell to ground and shot himself in the head. He had two guns with 28 rounds left when he died.

The police are yet to establish a motive behind the attack.

“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,” said priest Amaury Thomazi in a video published on social media. “Nobody was able to do anything.”

The archdiocese of Sao Paulo on its Facebook page said that the killings provoked “deep pain”, adding that the cathedral would be closed for as long as needed for police investigation.

Brazil last year registered 63,880 murders and its murder rate of 30.8 per 1,00,000 citizens is three times higher than the level the United Nations considers to meet the definition of “endemic violence”. President Jair Bolsonaro, who takes office in January, won the elections last month and plans to relax gun legislation to allow Brazilians to arm themselves against criminals.