Thursday, demonstrating it can still attack civilians despite a regional offensive that has forced it into retreat.
The sources said Boko Haram attacked a settlement on the way into the centre of Gambaru, on the border with Cameroon, on Wednesday afternoon. The nearby village of Ngala was also attacked.
Gambaru, near Lake Chad, had been captured from the militants by Chadian troops last month. On Tuesday the Nigerian army said it had repelled Boko Haram from all but three districts of the northeast, less than two weeks before a presidential election.
Boko Haram has killed thousands of people in a six-year insurgency to carve out an Islamic state in northeastern Nigeria. The group, which until the start of this year controlled territory the size of Belgium, has been squeezed back in the run-up to the March 28 poll, in which President Goodluck Jonathan will seek re-election.Olu Adejuwon, staying in the Cameroonian town of Fotokol which is separated from Gambaru by a river, said he had heard gunshots on Wednesday afternoon that continued for a long time. "There was a gun battle with some Cameroon soldiers," he said.
Chadian troops, who had pushed as far as Dikwa in Nigeria's northeast Borno state, pulled back last week into Fotokol.
Nigeria, Chad, Cameroon and Niger are in the process of planning and seeking United Nations backing for a joint 10,000-strong force to defeat the insurgents, though coordination has been disjointed and plagued by mistrust and rivalry.