Four people were killed and four others were injured after a gunman opened fire during Mass inside a Catholic cathedral in southeast Brazil on Tuesday, officials said.

The gunman ended up killing himself, officials said.

Officials said the unidentified man, armed with a pistol and a .38 caliber revolver, entered the Metropolitan Cathedral in Campinas, a city about 60 miles north of Sao Paulo, the Folha de S. Paulo reported.

Globo News reported the man walked to the front of the church during Mass and opened fire. Then he turned the gun on himself, the military police told the newspaper.

The four people who were injured were taken to local hospitals. Their conditions were not immediately known.

“We do not have information on motivation or who the victims were," Alexandre Monteiro with the military police told O Globo newspaper. “Most [were] elderly, innocent people and he [the suspect] ended up firing on all these people. The scene is desperate, a great tragedy.”

Hamilton Caviola Filho, the local police chief, told Globo they estimate the gunman fired at least 20 rounds and there could have been a greater death toll had military police not entered the church as soon as they heard gunshots.

“I entered the church, the Mass was over. A few minutes later the gunman came in and stood in de front of a couple and opened fire,” Pedro Rodrigues told Folha de S. Paulo. “I ran away, there was no screaming, just running. And he kept firing. I’m very lucky to be alive.”

Wilson Cassante, a spokesman for the Campinas archdiocese, told The Associated Press the officiating priest had left before the shooting began. He said church officials did not recognize the shooter or have any ideas about his motive.

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

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

The Associated Press contributed to this report.