The Nigerian army says it has retaken the north-eastern town of Gwoza, believed to be the headquarters of militant Islamist group Boko Haram.
The insurgents had now been driven from virtually all the territory they had held, it said.
Some militants were now fleeing towards border areas, the military said.
News of Gwoza’s recapture comes a day before presidential elections, which were postponed by six weeks because of the offensive against Boko Haram.
Thousands of people have been killed since 2009, when the group began its insurgency to create an Islamic state.
An estimated three million people have fled their homes because of the unrest, and many may be unable to vote.