* Attackers spray village mosque with bullets
* Violence on the rise in Nigeria's volatile north
KADUNA, Oct 14 (Reuters) - Armed bandits descended on a village in northern Nigeria on Sunday, killing 22 people, most of them shot dead as they were leaving prayers at a mosque, the state police commissioner said.
The attack happened in a remote village called Dogo Dawa in Kaduna state, commissioner Olufemi Adenaike told a news conference. He added that two of the robbers had also been killed.
An investigation had revealed it was a revenge attack by the armed gang because four of its members had been arrested by vigilantes in the village and taken to the police.
"Following the arrest, some unidentified armed gang in Kuyello village, mobilised in large numbers and stormed the village in the early hours of Sunday in a bid to rescue the four persons arrested," he said.
"The gang descended on innocent members of the village, killing a total of 22 persons."
Most of the victims were killed as they left the village mosque, although a number were also killed in their homes, he said. He added that two of the gang members had been killed by the vigilantes in revenge.
Like much of northern Nigeria, Kaduna is plagued by an insurgency led by radical Islamist sect Boko Haram. That, 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.
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.
Abdullahi Muhammad, the traditional ruler and councillor of Birnin Gwari, a local government area next door to the village, earlier said the attack was carried out by a well known gang.
"The village had been terrorised 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," he said.