The attack in the Bukkuyum local government area took place during Friday prayers at the Jumu'at central mosque in Ruwan Jema town, three residents told Reuters.

"The armed bandits came on motorbikes while holding their guns and moved straight to the mosque and began to shoot sporadically us," resident Amimu Mustapha said.

Another resident who asked not to be named said the attack took place at roughly 2 p.m. local time, adding there were many others injured.

A spokesman for Zamfara state police did not immediately respond to calls or text messages seeking to confirm the residents' reports.

In August, Ruwan Jema residents said they gave bandits 9 million naira ($21,000), petrol and cigarettes with the promise that the men would leave them alone.

Gangs of heavily armed men, known locally as bandits, have wreaked havoc across northwest Nigeria in the past two years, kidnapping thousands, killing hundreds and making it unsafe to travel by road or farm in some areas.

The attacks have confounded overstretched security forces. The military last week warned residents in Zamfara and two other states to leave forested areas ahead of a bombing campaign targeting bandits and terrorists.

($1 = 430.0500 naira)

(Reporting By Maiduguri newsroom, writing by Libby George, editing by Clelia Oziel)