Boko Haram has intensified attacks on military targets in Nigeria of late, in an attempt to undermine repeated claims that the militants had been defeated.

Kano: At least 30 Nigerian soldiers died in combat with Boko Haram jihadists who overran a military base in the northeast near the border with Niger, two military sources told AFP on Saturday.

Scores of jihadists in trucks stormed the base at Zari village in northern Borno state late Thursday and briefly seized it after a fierce battle, they said.

"They came in large numbers in trucks and carrying heavy weapons and engaged soldiers in a battle that lasted for an hour. We lost at least 30 men," a military officer said, adding that the attack took place at around 4 pm.

"They overwhelmed the troops who were forced to temporarily withdraw before reinforcements arrived," said the officer who asked not to be named because he was not authorised to speak.

Boko Haram has intensified attacks on military targets in recent months. The attacks appear to undermine repeated claims by the military that Boko Haram had been defeated.

The militants took weapons and military equipment before they were pushed out of the base by troops with aerial support, said a second military source who gave a similar toll. The militants were pursued and bombarded by a fighter jet, said the military sources.

"The terrorists also suffered heavy casualty from the bombardment", one of the military officers said.

Zari is located 30 kilometres from the town of Damasak on the border with Niger. The jihadists are thought to have attacked the base from the nearby Garunda village, where 17 troops were killed and 14 injured in an attack on another military base last month, the sources said.

In a statement late Friday the Nigerian military confirmed troops fought Boko Haram "insurgents...on rampage to loot the community and extort money from villagers". "Troops...have successfully routed Boko Haram insurgents in an encounter that ensued yesterday evening at Zari village," the military said in the statement.

It did not speak of military casualties and the raid on the base but maintained "several Boko Haram fighters and weapons" were destroyed in the fight.

The Nigerian army has on several occasions disputed reports on losses to Boko Haram and has in some cases played them down.

On 14 July, Boko Haram militants overran a military base in Jilli village, in neighbouring Yobe state when dozens of troops were said to be been killed, wounded or missing. The army at the time conceded the base was attacked but said troops remobilised and succeeded in repelling the attackers.

In a short statement on Wednesday, Islamic State-affiliated Boko Haram jihadists claimed to have killed "several" Nigerian troops in mortar strikes on a military base in the town of Arge in the Lake Chad area.

AFP could not independently verify the claim.

The Boko Haram insurgency, which is in its ninth in Nigeria, year has left 20,000 people dead and displaced 2.6 million. Soldiers and civilians have also been targeted in separate attacks in neighbouring Chad and Niger.