SAO PAULO (Reuters) - A gunman entered a Catholic cathedral in the Brazilian city of Campinas on Tuesday and fatally shot four people attending midday mass before killing himself at the altar, fire department officials said.

Four elderly people were seriously wounded by the man, who began shooting at the congregation with two guns, according to a spokesman with the fire department in Campinas, an industrial city 100 kilometers (62 miles) northwest of Sao Paulo, where the shooting took place.

"It was frightful," witness Alexandre Moraes told the GloboNews channel. "He entered and shot randomly at people. They were all praying."

Police agents stand near a body at the Metropolitan Cathedral of Campinas, Sao Paulo, Brazil on December 11, 2018. A shooter killed four during a mass inside the Metropolitan Cathedral of Campinas before committing suicide in front of the altar, according to official sources. Denny Cesare / EPA

The wounded were taken to a hospital in Campinas.

Firemen at the scene said they had not identified the gunman.

Brazil had nearly 64,000 murders last year - more than any other country, according to the United Nations. However, random mass shootings are relatively rare, with few American-style shootings in schools or other public areas.

(Reporting by Tatiana Ramil and Anthony Boadle; Editing by Phil Berlowitz and Bill Trott)