At least 31 Nigerian soldiers were killed when IS-aligned fighters ambushed a military convoy escorting weapons and overran a base in northeast Nigeria's Borno state, military sources said on Monday.
Fighters from the Islamic State West Africa Province (ISWAP) attacked the convoy with rocket-propelled grenades on Sunday in the town of Mainok outside the regional capital Maiduguri before storming the nearby base, the two sources said.
The attack was the deadliest this year against Nigeria's army which has been battling a decade-long jihadist insurgency in the region that has killed 36,000 people and displaced around two million from their homes.
"We lost 31 soldiers, including their commander who was a lieutenant colonel, in the ambush by the terrorists," a military officer said about the attack which happened around 1100 GMT.
The convoy was transporting weapons to Maiduguri when it came under attack, said a second military source who gave a similar toll.
"The terrorists came in several trucks, including four MRAPs (Mine Resistant Ambush Protected vehicles) and engaged the convoy in a fierce battle," the second source said.
The militants overwhelmed soldiers, leading to the "colossal loss" of troops, he said.
"We lost a lot of men in very gruesome way."
The jihadists seized weapons and two MRAPs in the attack before overrunning and partially burning the base outside the town, the two sources said.
Mainok, about 50 kilometres (30 miles) from Maiduguri, has been repeatedly targeted by the jihadists.
ISWAP has frequently set up bogus checkpoints along the 120-km highway linking Maiduguri and Damaturu in neighbouring Yobe state on which Mainok lies, killing and abducting travellers.
ISWAP split from the mainstream Boko Haram faction in 2016 and rose to become a dominant force in the northeast as Nigeria's conflict has spilt over borders into neighbouring Chad, Niger and Cameroon.