The terrorists were ambushed by a combination of the Community Protection Group, vigilante members and armed residents in the two communities.
Many bandits were killed why attempting to raid Matuzgi, a community in Talatar Mafara Local Government Area of Zamfara State, on Tuesday.
Residents said 35 bandits were killed by the local vigilante and the state's Community Protection Guard (CPG) stationed in the community.
Residents said soldiers later arrived in the area and joined the fight, forcing the bandits to retreat from Matusgi.
Ten more bandits were killed in neighbouring Magamin Diddi, community in Maradun Local Government Area, as they fled from the fight at Matusgi.
Residents said three villagers in Matusgi lost their lives in the attack.
"We received information that the bandits were coming towards our community around 2 p.m that day," a vigilante member who sought anonymity for safety reason told PREMIUM TIMES over the phone.
"Vigilante members and armed residents were quickly mobilised to wait for the bandits," the source said.
The source, now in Talata Mafara town, said the terrorists were caught unaware by the vigilante group and CPG. "We waited for them until they were very close to the community and then we engaged them."
A security agent posted to Talata Mafara also confirmed the killing of terrorists but was unsure of the number killed as "bandits are known to take away corpses of their members killed."
The police spokesperson in Zamfara, Yazid Abubakar, has yet to comment on the incident.