Nigerian soldiers on Wednesday repelled an attack by Boko Haram jihadists on the northeast city of Maiduguri, security sources and residents told AFP.
The attack, the latest in a wave of assaults by Islamist gunmen, was repulsed hours before President Muhammadu Buhari was sworn into office for a second term in power.
Soldiers intercepted a "huge number" of fighters from Boko Haram on the outskirts of Maiduguri on Tuesday night, beginning a night-long battle that continued until close to dawn on Wednesday.
"Our troops did an impressive job, and fought off the terrorists," said a military source, who asked to be named.
Troops fought all night, and "forced them to withdraw by dawn," the source said.
A member of a self-defence militia, that fights alongside regular troops, said Boko Haram forces were spotted as they moved towards the city in the dark.
"Luckily they were sighted by soldiers, who fought them all night long," the militia fighter said.
Residents of the city reported the sounds of a heavy battle.
"We kept hearing explosions and the sound of gunfire throughout the night," Maiduguri resident Nasiru Fannami said.
It was not clear if there were any casualties.
Boko Haram militants have launched several failed attempts to overrun Maiduguri.
Their decade-long campaign of violence has killed tens of thousands of people and displaced millions across the region.
The violence has spilled over into neighbouring Niger, Chad and Cameroon, prompting a regional military coalition to battle the jihadist group.
Buhari, who was sworn in as president for a second four-year term later on Wednesday, has said defeating of Boko Haram - and ending a raft of other security threats - is a key part of his work.