Islamist Boko Haram insurgents have overrun much of a northeastern Nigerian town after hours of fighting that has killed scores and displaced thousands of residents, several security sources said on Tuesday.
The Islamists launched an attack on the town of Bama, 70 km (45 miles) from the Borno state capital of Maiduguri, on Monday. They were initially repelled but came back in greater numbers overnight, the sources and witnesses said.
Nigeria's defence spokesman did not immediately respond to a request for comment. The sources said there were heavy casualties on both sides. One security source said as many as 5,000 people fled the town.
In a bungled air strike, several Nigerian troops were killed at the Bama armoury by a fighter jet targeting the insurgents, a soldier on the ground told Reuters.
Two months after Islamist militants in Iraq and Syria declared the area they seized an Islamic caliphate, Boko Haram has also for the first time explicitly laid claim to territory it says it controls in parts of northeast Nigeria.
They captured the remote hilly farming town of Gwoza, along the Cameroon border, during fighting last month. The group's leader Abubakar Shekau in a video declared it a "Muslim territory" that would be ruled by strict Islamic law.
Shekau's forces have killed thousands since launching an uprising in 2009 to revive a medieval Islamic caliphate in religiously mixed Nigeria, and are seen as the biggest security threat to the continent's leading energy producer.
"When we started hearing gunshots, everybody was confused. There was firing from different directions. We just ran to the outskirts of town," Bukar Auwalu, a trader who fled with his wife, three children and brother, told Reuters by phone.
"There were military helicopters and a fighter jet. We slept in the bush on the outskirts of town."
Because of Bama's proximity to Maiduguri, a large metropolis and home of a major army base, security officials are worried there is now little to keep Boko Haram from gaining access to a key city that was also the birthplace of their movement.
Boko Haram briefly got itself in the international spotlight on July 22, when its fighters kidnapped more than 200 girls from a school in the northeastern village of Chibok in April. They remain in captivity.
Their tactics have started to resemble those of Ugandan warlord Joseph Kony and his Lord's Resistance Army: kidnapping boys and forcing them to fight while taking girls as "wives".
A military offensive launched over a year ago that was meant to crush them has merely made the rebels more brutal.
The apparent powerlessness of the military to protect civilians or prevent the militants mounting constant raids has triggered much criticism of President Goodluck Jonathan's administration, although it argues counter-insurgency is something new the government is having to learn how to fight.
A soldier involved in the Bama fighting, who declined to be named, said the insurgents had targeted the Bama armoury with heavy weapons including tanks. As troops tried to repel the attack, they called in air reinforcements.
But by the time the fighter jet arrived, they had mostly lost the battle for this location. The jet then bombed the area but accidentally killed everyone there, both Nigerian troops and insurgents, the soldier said.
"The situation is bad. We lost so many of our men," he said.
Farmer Ibrahim Malu said hundreds had fled the town. He had gone out to his farm just before morning prayers when gunfire and loud explosions erupted. He ran back home, but by the time he got there his wife and children had already fled.
"I still don't even know where they could be," he told Reuters by telephone. "Two soldiers fled with me. One of them didn't even have any shoes."