Armed bandits stormed the villages in the Birnin Magaji area of Zamfara state, in an apparent reprisal attack after local militia killed one of their number, said locals.
Police spokesman Mohammed Shehu told AFP that "10 people were killed by the bandits".
"From our reports, the attackers fled to the Rugu forest in neighboring Katsina state," he added, Presstv Reported.
Local residents, however, gave a higher death toll.
"We lost 26 people in the attacks on Dutsin Wake, Oho, Badambaji and Kabingiro (villages)," said Dantani Bube, who lives in Dutsin Wake.
Seventeen were killed in Dutsin Wake, seven in Oho and one each in Badambaji and Kabingiro, another resident, Lawwali Maishanu, told AFP by telephone from the area.
Maishanu said local militia had earlier killed a suspected bandit at a market. Bandits then demanded the civilian vigilantes hand over those responsible, but they refused.
Bube and Maishanu said the gang then traced the militia members suspected of the killing to the four villages.
Zamfara has for several years been gripped by violence from armed gangs of cattle rustlers who have targeted herding and farming communities.Cattle has been stolen and residents who resist them killed.
That has led to villagers forming civilian militia groups as protection.
But they, too, have been accused of abuses and killings of suspected thieves, leading to tit-for-tat attacks.
On June 2 cattle thieves killed 23 people in the village of Zanoka after a battle with militia members who prevented them from stealing cattle.
In recent years the gangs have added kidnapping for ransom to the criminal activities across Zamfara and neighboring Kaduna and Katsina states.
Despite the deployment of troops in the affected communities in the last two months the criminal gangs still operate.