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.
After his fighters captured Gwoza in August 2014, the Boko Haram leader declared a caliphate in areas under his control.
The militants have been pushed back since Nigeria’s neighbours sent troops to help it earlier this year.
“These successful operations have culminated in the dislodgment of terrorists from towns and communities in Adamawa, Yobe and Borno states,” military spokesman Chris Olukolade said.
The recapture of Gwoza was first announced in a tweet from Nigerian armed forces.
A lot of arms and ammunition were recovered and “a massive cordon and search has commenced to locate any of the fleeing terrorists or hostages in their custody”, Mr Olukolade said.