Boko Haram Takfiri terrorists have overrun a military base following a ferocious gun fight with Nigerian troops in the country's troubled northeast.

The militants invaded the base holding hundreds of soldiers in Yobe state in an hours-long onslaught Saturday night.

"Boko Haram terrorists attacked troops of the 81st Division Forward Brigade at Jilli village in Geidam district. The terrorists came in huge numbers around 7:30 pm (1830 GMT) and overran the base after a fierce battle that lasted till 9:10 pm," AFP quoted a military source as saying.

"The base had 734 troops. Currently the commander of the base and 63 soldiers have made it to Geidam (60 kilometers away) while the remaining 670 are being expected," he said.

"We don't know if there were any casualties among the troops. That will be known later."

A leader of a local anti-militant militia attributed the attack to the Abu-Mus'ab Al-Barnawi faction of Boko Haram, which is known for targeting Nigerian forces.

"We learned that they drove from Lake Chad through Gubio (in nearby Borno state) and attacked the base."

Geidam resident Fannami Gana said that Boko Haram militants "overwhelmed" the troops. "We don't know the details of what happened but we learnt they were overwhelmed by hundreds of Boko Haram gunmen."

Since 2009, Boko Haram militancy has left at least 20,000 dead and made over 2.6 million others homeless.

Nigerian President Muhammadu Buhari, a former general, came to power in 2015 on a platform of stamping out Boko Haram, but despite retaking swathes of territory from the group, it continues to stage attacks targeting both civilians and military targets.