The incident took place Friday when the gunmen -- hiding among civilians -- opened fire on soldiers, said Brig. Gen. Austin Edokpaye, commander of the Joint Task Force.
"We've received intelligence that some suspected Boko Haram members usually pray and hide arms at a particular mosque in town. It was around that mosque that our men were attacked with several of them injured and an officer died," he said. "When we reinforced and returned to the scene, the terrorists came out with heavy firepower including RPGs [rocket-propelled grenades] which usually have a conflagration effect."
At least 2,000 homes were destroyed by the subsequent fires, which also killed many elderly and children, CNN reported.
Gov. Kashim Shettima visited Baga Sunday and urged residents who had fled to the bush to return to their homes, CNN said.
He said a committee had been formed to provide compensation losses. He called the incident a "nasty occurrence."
Man spent 15 hours in jail for plugging electric car into an outlet at a school
Exploding whale video goes viral on Internet