Damboa - Witnesses say suspected Islamic militants lured the faithful to a mosque then gunned them down.
They say the gunmen killed at least seven people before being attacked by soldiers guarding Damboa village, 85km west of the Borno state capital of Maiduguri in northeast Nigeria.
Military spokesperson Captain Aliyu Danja said troops killed 15 attackers.
Resident Kolomi Abba said the attack comes after he formed a group of civilian vigilantes to fight the extremists.
He said the gunmen came around 04:00. Saturday and forced the muezzin to chant the call to prayer that usually happens at 05:00. When villagers arrived, the extremists opened fire.
It is the latest in a string of attacks blamed on the Boko Haram group fighting to install an Islamic state.