Gunmen abducted 10 worshippers from a mosque in northwestern Nigeria near the border with Niger on Monday, police have said.
Armed gangs, known locally as "bandits," terrorize people in central and northwestern Nigeria, looting villages, stealing livestock and carrying out mass kidnappings for ransom.
Attacks on mosques, however, are very rare.
At around 01:00 GMT on Monday, gunmen entered a mosque in Jibiya, Katsina State, where 47 people were attending Ramadan prayers, said state police spokesman Gambo Isa.
"The bandits abducted 40 worshippers, taking them out of the mosque and into the forest," Isa added.
"They were pursued by police officers, assisted by local vigilante groups and residents of the town, and they managed to free 30 of the hostages," the spokesman said. The kidnappers fled with 10 worshippers.
The attackers are believed to have come from Dumburum forest in neighboring Zamfara state, where they have several hideouts, the spokesman said.
These criminal groups are acting out of greed, and apparently without ideological motivation. But many experts have warned that they are linked to jihadist groups in the northeast of the country, hundreds of kilometers away.