Gunmen on motorbikes stormed into four villages in Kankara and Danmusa districts in Katsina state on Wednesday, shooting residents as they fled.
"We collected 18 dead bodies from the four villages after the attacks," said Sada Iliya, a community leader from Unguwar Rabo village where nine people were killed.
"The bandits rode through the villages, opening fire on people," he said.
Residents on Thursday transported the bodies to the state capital 130 kilometres (80 miles) away and presented them to the traditional emir in protest at the attacks.
"We took the 18 corpses to Katsina for the emir (so that he could) see what we are going through at the hands of bandits," said Isyaku Jari from Maidabino village.
The victims were buried the same day after funeral prayers attended by the emir, his entourage said.
Katsina state has suffered months of attacks by cattle thieves and kidnappers, prompting villagers to form vigilante groups to protect themselves.
The gangs hole up in forests, using them as bases from which to launch assaults.
In May, 34 people were killed when bandits attacked three villages in Batsari and Danmusa districts, according to police and residents.
The latest violence comes amid efforts to halt the attacks in neighbouring Zamfara state, which has seen the worst of the bloodshed.
Bandits, herders and local vigilantes attended a peace meeting on Tuesday brokered by the regional government and police.
Farmers and herding communities in the area have long been terrorised by the gangs but the vigilante groups they have formed have been accused of extra-judicial killings.
The gangs have demanded that their suspected members stop being targeted for reprisal attacks, while mediators are pushing for both sides to disarm.