Boko Haram gunmen dressed in military uniform have killed 19 people near the Nigerian border with Cameroon in the restive northeast, residents and a survivor say.

The motorcycle-riding gunmen armed with Kalashnikovs blocked the highway early on Sunday morning near the town of Logumani, 30km from the border, shooting and hacking to death 19 motorists and burning three trucks, they said.

"We have recovered 19 dead bodies from the scene of the attack by Boko Haram gunmen," Musa Abur, leader of a civilian vigilante group in the area said.

"Five of the victims, who included two truck drivers and their assistants, were shot dead while the rest were slaughtered," he said.

He said the gunmen had attacked the border town of Gamboru Ngala near Logumani late on Friday but were repelled by soldiers and local vigilantes.

A passenger who survived the attack gave a similar account.

"We were asked to get out of our vehicles and lie face down by nine men dressed as soldiers who blocked the road around 5am," the man who gave his name as Buba told AFP.

"They shot dead five people and went about slaughtering 14 others before someone called them on the phone that soldiers were heading their way," he said.

"They abandoned the rest of us and sped into the bush on their motorcycles," added Buba who was shot in the leg.

The military authorities in the region could not be immediately reached to comment on the attack.

The phone network has been switched off in much of the northeast since emergency measures were declared mid-May at the start of a military offensive against insurgents.

Residents of towns near the border with Cameroon have been relying on mobile phone service from Cameroon telecom operators since the military crackdown.

Boko Haram Islamists have stepped up deadly attacks on civilians and schools in reprisals against vigilantes co-operating with the military.

Boko Haram has said it is fighting to create an Islamic state in Nigeria's mainly Muslim north, and violence by the group is estimated to have cost more than 3600 lives, including killings by the security forces.
Boko Haram Islamists 'kill 19 in Nigeria'