Gunmen using explosives killed at least 21 people, including children, in an attack on a Catholic church in southwest Nigeria, local officials said, in violence that drew widespread international condemnation.

The bloodshed at St. Francis Catholic Church in Owo town during a Sunday service was a rare assault in Nigeria's usually safer southwest and shocked a country grown used to jihadist attacks and mass kidnappings in the north.

Blood still stained the church floor and debris lay scattered around a day after the attack that Ondo State governor's office said killed at least 21 people.

Gunmen hid among the worshippers inside the church and also opened fire on the congregation through the windows from outside.

"Investigations revealed that some of the gunmen disguised as congregants, while other armed men who had positioned themselves around the church premises from different directions, fired into the church," the police statement said.

Fragments of explosives and three unexploded improvised devices were found at the scene.

Richard Olatunde, spokesman for the Ondo State governor's office, told AFP 21 people died after gunmen detonated dynamite inside the church before opening fire.

The attack on a church in Owo left 21 dead
The attack on a church in Owo left 21 dead AFP

National Emergency Management Agency local representative Olanrewaju Kadiri said 22 people were killed, including several children, with another 40 people wounded.

No group has so far claimed responsibility for the attack and the motives were not immediately clear.

Vice President Yemi Osinbajo arrived on Monday to visit some of the wounded in Owo where he said perpetrators "will pay for this heinous" attack.

Survivors described panic as worshippers fled a sudden outburst of gunshots.

Father Andrew Abayomi, who conducted the service, told AFP some worshippers managed to close the church door and he escaped with others, including children, into the vestry to hide for about 20 minutes before emerging to the carnage.

"Even before leaving the church premises, I have seen some lifeless: I saw a woman shot beside the bus," he said.

Another survivor, Bade Salawu, recalled disbelief at hearing gunshots inside the church.

Map of Nigeria locating Owo, in Ondo state
Map of Nigeria locating Owo, in Ondo state AFP / Eléonore HUGHES

"They didn't come to steal anything, they didn't come to kidnap anybody... their aim was to just kill and destroy."

Another witness told AFP he saw at least five gunmen on the church premises.

The state government declared a seven-day mourning period for the victims, and ordered the national flag to be flown at half-mast in Ondo.

Pope Francis was "deeply saddened" by the "horrible attack", his number two, Vatican Secretary of State Cardinal Pietro Parolin wrote in a telegram to the bishop of Ondo.

The pope assures "all those who are affected by this unspeakable act of violence of his spiritual closeness", he said.

President Muhammadu Buhari condemned the "heinous killing of worshippers", while the UN special representative for West Africa and the Sahel, Mahamat Saleh Annadif, spoke of a "barbaric terrorist attack".

Nigeria's military is fighting a 12-year-long jihadist insurgency in the northeast and heavily armed criminal gangs often carry out looting raids and mass kidnappings in the northwest and north-central parts.

But large-scale attacks in Nigeria's southwest are relatively rare, although kidnappings for ransom have become increasingly common.

Boko Haram jihadists in the northeast have targeted churches in the past. Nigeria's jihadist conflict has killed 40,000 and displaced two million more in the northeast.

The attack came a day before the ruling APC party started primaries for its candidate in the 2023 election to replace Buhari, a former army commander who steps down after two terms in office.

Security will be a major challenge for whoever wins the race to govern Africa's most populous country and the continent's largest economy.

As well as jihadists and criminal gangs known locally as bandits, Nigeria's security forces are also dealing with separatist agitation in the southeast.