RIO DE JANEIRO — A man opened fire inside a Catholic cathedral in southern Brazil after Mass on Tuesday, killing four and injuring four others before turning a gun on himself, authorities said. The shooting occurred right after Mass at the Metropolitan Cathedral in Campinas, a city about 60 miles north of Sao Paulo.

The injured were taken to local hospitals, Sao Paulo state firefighters said. Their conditions were not immediately known. Authorities have yet to release the name or age of the suspect.

The officiating priest had left before the shooting began and church officials did not recognize the gunman or have any ideas about his motive, according to Wilson Cassante, a spokesman for the archdiocese.

Get Breaking News Delivered to Your Inbox

"It's so sad," said Cassante. "It's hard to imagine the pain this has caused."

Authorities had reviewed surveillance footage from inside the cathedral, Hamilton Caviola Filho, a police investigator, told news portal G1. The shooter "came into the church, sat on a chair, with time to think, and then got up and starting shooting," he said.

Before the gunman shot himself in the head, the suspect took a bullet in the ribs from responding police, Caviola Filho said. In total, he said the suspect fired at least 20 shots.

"It was frightful," Alexandre Moraes, a witness, told Globo News, according to BBC News. "He entered and shot randomly at people. They were all praying."

Images on Globo News showed paramedics taking bodies and injured from the church. Firefighter Alexandre Monteiro told G1 that the four injured were in stable condition.

While Brazil leads the world in total annual homicides, mass shootings are relatively rare.