The attack happened at about 8:00 pm (1900 GMT) in Kuda village near the town of Gulak, in Adamawa state, according to Maina Ularamu, a former local government chairman in nearby Madagali.
Adamawa police spokesman Othman Abubakar, based in the state capital Yola, 255 kilometres (160 miles) away, confirmed the attack.
But he gave a lower death toll of 18 and said “many others were injured”.
Ularamu said the attack occurred during a “mourning celebration” to mark the death of a local community leader.
“They came on motorcycles and opened fire on the crowd, killing 24. Most of the victims were women. They looted food supplies and burnt homes and they left almost an hour later,” he told media.
“Gulak has been liberated from Boko Haram but the gunmen still live in villages nearby. They attack mostly to loot food supplies.
“Our people who fled their homes to escape Boko Haram attacks have been returning because they cant live in the camps.
“But now they are facing threats from Boko Haram who launch nocturnal attacks.”
Boko Haram threatened to overrun Adamawa state in 2014, sweeping down from their Sambisa Forest stronghold which lies just across the border in Borno state to Mubi, 80 kilometres south of Gulak.
The rampage, which left bridges and homes destroyed on the only road south to Yola, forced tens of thousands of people from their homes to flee into camps and host communities in the state capital.
Boko Haram was driven out of the state by a military counter-offensive that began in January 2015 and since there has been a relative calm despite sporadic attacks in the north of the state.
The last attack in Adamawa was on January 9, when seven people were killed and two others injured in a raid on Madagali.
Two female suicide bombers blew themselves up at a market in Madagali on December 28, killing 30, just days after President Muhammadu Buhari declared the Islamists “technically” defeated.
There has been a noticeable fall in attacks since the turn of the year and the military claims the Islamic State affiliate is severely weakened and pushed into border areas around Lake Chad.
But Thursdays attack is an indication that the rebels, who want to create a hardline Islamic state in northeast Nigeria, are not routed, and still have the capacity to strike.
The army in late April began an assault on Sambisa Forest, which is believed to have pushed out remaining fighters.
On Tuesday, fighters attacked Kutuva village in the Damboa area of Borno state, on the other side of the former game reserve, killing four and kidnapping four women.
At least 20,000 people have been killed and more than 2.6 million people forced from their homes since the insurgency began in 2009.
Jan 17, 2017 0
Special coverage on China's Two Party Sessions by The Daily Mail - People's Daily