Islamic State’s West African branch claimed responsibility for the attack on a Nigerian army base in Borno state and said its fighters killed 20 soldiers.
The assault, which raised questions about government claims to have almost defeated the insurgents, took place in Kareto last week.
The barracks were burnt and a tank destroyed, Islamic State in West Africa (ISWA) said in a statement published on the SITE Intelligence website.
Security sources said earlier the base, home to the Nigerian Army’s 158th Battalion and 130 km from state capital Maiduguri, was overrun and the commander killed.
After the assault, the militants left, but remained in the area the sources said.
The Nigerian Army did not respond to requests for comment.
Islamic State in West Africa (ISWA), which split from Nigerian Islamist group Boko Haram in 2016, carried out attacks in the north-east over the last months, including military bases.
Government said the Boko Haram insurgency and the rival Islamic State West Africa Province group are on their last legs. Sustained efforts to eradicate the militants have failed and the military continues to suffer heavy losses.
The insurgency has killed more than 30,000 people and displaced millions of civilians in affected areas.
President Muhammadu Buhari, in his second-term inaugural speech, said government would provide more support for the security forces in terms of money and equipment.