At least 45 people died in an attack by armed bandits on a village in northern Nigeria, civilian militia members and police officials said.

"Yesterday we recovered 12 corpses and today we retrieved 33," Austin Iwar, Kaduna's commissioner of police, told Reuters by phone.

"The 45 bodies were found scattered in the bush. The bandits pursued residents who mobilised to defend the village after overpowering them," also said a vigilante who asked not to be named for fear of reprisals. "The dead included children abandoned by their parents during the attack.

The village, in the Birnin-Gwari area of Kaduna, lies near an area known for banditry, where thick forests provide remote hideouts from law enforcement.

Those groups of bandits have for years frustrated authorities' attempts to apprehend them, and in some cases have amassed thousands of stolen cattle and fought off security agent task forces sent to deal with them.

President Muhammadu Buhari won Nigeria's 2015 elections partly on promises to bring security to Africa's largest economy and most populous nation, but has struggled to fulfil those pledges. He is now seeking a second term in February 2019.

His critics and opponents question his track record tackling the multitude of conflicts that plagueNigeria, from Boko Haram and a thriving Islamic State West Africa insurgency in the northeast, to clashes between farmers and herders in the hinterlands that have left hundreds dead.