Armed assailants killed four police officers and two civilian militiamen in an attack on a military base in northeast Nigeria's Borno state on Wednesday.
Suspected Boko Haram fighters in trucks fitted with machine guns launched the dawn raid on the army base in the town of Damboa, sparking intense fighting.
"We lost four mobile policemen and two civilian militia fighting alongside soldiers during the fight with the terrorists," said a military officer, who spoke on condition of anonymity.
Anti-armed group leader Ibrahim Liman confirmed the death toll, after supporting soldiers during the attack.
Local resident Modu Malari said the assailants attacked with assault weapons and rocket-propelled grenades, but were forced out from the town by troops after a fierce two-hour battle.
More than 50 residents were wounded by shrapnel from grenades fired by the rebels, he said.
Damboa lies on the fringe of Boko Haram's Sambisa Forest stronghold, from where the group has launched repeated attacks on villages and military posts.
In November last year, at least 10 Nigerian soldiers were killed and nine injured in a Boko Haram ambush in Muchima village, outside Damboa.
Boko Haram's campaign began in 2009 and has displaced more than 2.2 million people across Nigeria, Chad, Niger and Cameroon since, with no signs of slowing down despite counterattacks by a joint multinational force across borders.
Islamic State of West Africa Province (ISWAP), a Boko Haram faction, has also gone on a spree of violence, attacking military formations in those countries.
In Mali and Burkina Faso, groups such as the al-Qaeda-affiliated Jama'at Nasr al-Islam wal Muslimin have followed suit, killing thousands of people in recent years.