Brig. Gen. Ibrahim Attahiru told CNN the attack began late Thursday and carried on through the night in Borno, in northeastern Nigeria.
The government held a news conference Friday featuring a young man who said he had been an unwilling recruit to Boko Haram, Nigeria's Leadership Newspapers reported. The group's stated aim is to establish Sharia law in heavily Muslim parts of Nigeria.
Malam Bukar Modu said he was found by government soldiers and arrested after he was wounded and left for dead during a Boko Haram operation Oct. 6.
Modu told reporters his cousin forced him into Boko Haram last year, telling him he would be killed if he did not join.
He said he had been involved as a "foot soldier" in operations in which innocent people were killed, and had stolen food and pharmaceuticals during raids.
"Sometimes, I feel guilty of committing crimes against God but our commanders always tell us that it is God's work that we are doing," he said. "It is a terrible thing to be a member of the sect but many foot soldiers like me cannot leave for fear of being killed."
Texas principal bans speaking Spanish, stirs controversy
Florida bear attack: Black bear mauls woman's face