At least 31 security personnel have been killed following an attack on a military base in Nigeria by Boko Haram fighters, security sources and witnesses said. 

The attack on the base in the northeast Nigerian town of Buni Yadi in Yobe State on Tuesday happened not far from where the group shot or burned to death 59 students at a boarding school in February.

Multiple witnesses said the armed men stormed the remote town at 8:00pm (19:00 GMT) on Monday, firing first on soldiers manning a checkpoint and razing the local police station.

A witness and resident of Buni Yadi, who identified himself only as Mustafa for fear of retribution, said the fighters arrived in an armoured personnel carrier and six Hilux trucks before dismounting and firing into the air.

They then torched the home of local government leader and several government buildings before turning their guns on an empty primary school, said witness Kura Babagana.

"When they started attacking, people began to flee," he said. "There were casualties on the part of the security personnel but I don't know how many."

'Bolder attacks'

Scores of vehicles were also burnt during the attack, he added, an account supported by other witnesses including Buni Ibrahim, a trader who was in the town at the time.

RELATED: Limited choices for women in Nigeria's north

Al Jazeera's Ahmed Idris, reporting from Abuja, said the attack reportedly lasted for three hours.

"This is not the first time that they have carried out such attacks and they have become bolder," our correspondent said.

Boko Haram, whose violent struggle for an Islamic state in northern Nigeria has killed thousands and made them the biggest threat to security in Africa's top oil-producing state, are still holding more than 200 girls kidnapped by the group on April 14.

Nigerian Chief of Defence Staff Air Marshal Alex Badeh said on Monday that the country's military knew the location of the schoolgirls, but that any potential armed rescue operation was fraught with danger as the girls could be caught in the crossfire.

US and European officials voiced scepticism about the statement.

Source: Al Jazeera and agencies