Nigerian security officials say a group of armed men attacked two villages in Zamfara State in the country's northwest.
A fresh outbreak of gang violence in northern Nigeria has left at least 27 people dead, locals told AFP on Friday, highlighting the volatile security situation in West Africa's largest economy.
On Thursday suspected cattle thieves launched reprisal attacks on two villages in northern Nigeria's Zamfara state, where security forces are battling to contain cattle-rustling gangs.
Gunmen on motorcycles attacked neighbouring Kabaro and Danmami villages in Maru district.
"Twenty people were killed in Kabaro and seven others were also shot dead in Danmami," Kabaro resident Lawwali Usmanu told AFP.
"We buried them this morning before the Friday prayers," said Usmanu, who attended the funeral of the victims.
"The perpetrators are the same cattle thieves that have been terrorising us for years, stealing our cattle and abducting people for ransom," said another resident Bubr Murtala.
The attack came after villagers had mobbed and killed a member of the cattle rustling gang, according to Usmanu.
Residents of the two villages had armed themselves with locally made guns to fight against the cattle rustlers who had superior weapons.
"All we have for defence are muskets but the bandits use modern firearms," Murtala said.
Zamfara state police spokesman Mohammed Shehu confirmed the attacks but declined to give details on casualties as the police officers were deployed for "on-the-spot assessment".
Earlier in April, 26 people were killed in an attack on gold miners in nearby Anka district that was also blamed on cattle rustlers, according to officials.
The killings were the latest in spate of deadly attacks by cattle thieves on herding and farming communities in the state.
Nigeria is battling an array of security threats across the country, from Boko Haram militants in the northeast to oil militants in the south.
Troops have been deployed in many states to combat criminal gangs involved in kidnapping and cattle rustling, as well to try to contain violent clashes between herdsmen and farmers.
In the absence of a robust police force and effective judicial system in Nigeria, villagers have created local vigilante groups to fight off the gangs.
But the vigilantes are equally responsible for the bloodshed and are also accused of extra-judicial killings.