KADUNA (Reuters) - Gunmen opened fire on Muslim worshippers as they were leaving a mosque in northern Nigeria on Sunday, killing at least 20 people, a local official said.

The attack happened in a remote village called Dogo Dawa, in Kaduna state, said Abdullahi Muhammad, the traditional ruler and councillor of Birnin Gwari, a local government area next door to the village.

There was no immediate claim of responsibility for the attack. Like much of northern Nigeria, Kaduna is plagued by an insurgency led by radical Islamist sect Boko Haram. They usually attack security forces, government officials or Christians, but have hit Muslim clerics and mosques in the past, especially ones that do not follow their hardline brand of Islam.

Kaduna also lies close to Nigeria's volatile "Middle Belt", where Nigeria's mostly Muslim north and largely Christian south meet, and where tensions over land and ethnicity often erupt into violence.

But Abdulladhi said the attack was most likely carried out by a local criminal gang.

"We are suspecting a reprisal attack by gangs of armed robbers who lost some of their members after a recent exchange of fire with the villagers and the vigilantes," he said.

"The village had been terrorized by an armed group operating from camps in the forest. These armed men mostly attack villages and motorists along the busy Kaduna to Lagos highway."

The state police commissioner Olufemi Adenaike confirmed the incident, but said he could not yet confirm the death toll.

The Islamist insurgency in northern Nigeria and weapons flooding in from its neighbours on the threshold of the Sahara have aggravated levels of violence in the region. Armed robberies and local disputes degenerating into deadly shootouts are increasingly common across the impoverished north.

(Reporting by Garba Mohammed; Writing by Tim Cocks; Editing by Alison Williams)