The announcement comes on the eve of the West African country's general elections.
"Just this morning, the gallant troops of the Nigerian military in a concerted and well-coordinated land and air operations have liberated Gwoza, the headquarters of their so-called caliphate," Major General Chris Olukolade said in a Defense Ministry statement Friday.
Olukolade said the troops had routed Boko Haram fighters in towns and villages leading to Gwoza.
"Several of the terrorists have died and many of them captured in the process. A lot of arms and ammunition have been recovered and the administrative headquarters completely destroyed. A massive cordon and search has commenced to locate any of the fleeing terrorists or hostages in their custody," Olukolade said.
Boko Haram declared its own "caliphate"
after seizing the area around Gwoza, in Borno state, in August 2014, according to the Chatham House think tank
. The militant group has purportedly pledged allegiance to ISIS and says its aim is to impose a stricter enforcement of Sharia law across Nigeria, which is split between the majority Muslim north and the mostly Christian south.
Nigeria's general elections take place Saturday .
The polls had been scheduled for February 14, but on February 7, Nigeria's election commission
announced they would be postponed for six weeks due to security concerns, with the military needing more time to secure areas controlled by Boko Haram. The controversial decision was unpopular among many Nigerians
and led to widespread protests.
Nigerian President Goodluck Jonathan, who is running for reelection, has been criticized for not doing enough to combat Boko Haram.
On Friday, Jonathan referenced the Gwoza victory in a broadcast to the nation, praising Nigeria's armed forces for their "immense sacrifices" in defending the nation.
"We are also glad that our gallant armed forces have successfully stemmed the seizure of Nigerian territories in the northeast by the terrorist group, Boko Haram," Jonathan said. "They have recaptured most of the communities and territories formerly occupied by the insurgents, making it possible for thousands of internally displaced Nigerians to begin returning to their homes and communities."
Election peace pledge
Jonathan said security agencies were fully prepared to deal decisively with "any group or persons who attempt to disrupt the peaceful conduct of the elections."
"Those who may harbor any intentions of testing our will by unleashing violence during the elections in order to advance their political ambitions should think again as all necessary measures have been put in place to ensure that any persons who breach the peace or cause public disorder during or after the elections are speedily apprehended and summarily dealt with according to our laws," the President said.
On Thursday, Jonathan and Maj. Gen. Muhammad Buhari, the other leading presidential candidate, issued a pledge reaffirming their commitment to "free, fair and credible elections
" following their signing of a nonviolence pledge -- the Abuja Accord
-- in January.
The International Criminal Court also issued a warning that anyone inciting or engaging in electoral violence "at a time when abhorrent levels of violence already plague parts of the country" is subject to prosecution, "either by Nigerian Courts or by the ICC."
"No one should doubt my Office's resolve to prosecute individuals responsible for the commission of ICC crimes, whenever necessary," ICC Chief Prosecutor Fatou Bensouda said in the statement.
Boko Haram attacks have killed at least 1,000 civilians so far this year, according to a Human Rights Watch (HRW) statement released Thursday.
Citing interviews with witnesses, it said the militants rounded up 300 Gwoza residents when it overran the town, then took them to a camp in the Sambisa Forest.
"After five months during which other residents remained trapped on the hills, hiding in caves and weakened by hunger, Boko Haram attacked the civilians there, killing many and forcing others to escape over the border into Cameroon," the rights group said.
"Each week that passes we learn of more brutal Boko Haram abuses against civilians," said HRW researcher Mausi Segun, adding that Nigeria "needs to make protecting civilians a priority in military operations against Boko Haram."
The rights group said Nigerian security forces had "failed to take all feasible precautions to protect the civilian population" when fighting Boko Haram but noted that, according to the government, military police were investigating those claims.
said in September that reports of alleged abuses by Nigerian security forces had increased since the government stepped up its fight against Boko Haram.
The rights group alleged systemic use of torture by the police, based on hundreds of witness testimonies and other evidence gathered over a 10-year span.
A spokesman for the Nigeria Police Force disputed the claims, saying torture and abuse were not "repeat, not an official policy of the Nigeria Police" and that the Amnesty report contained "some blatant falsehoods."
Earlier this month, ISIS purportedly said
it welcomed Boko Haram after the latter pledged allegiance to it.
In an audio message purportedly from an ISIS spokesman, the group announced that it had accepted a pledge of allegiance from Boko Haram.
ISIS supporters posted the audio online. CNN cannot independently authenticate the 28-minute message.
The message said that ISIS, which calls itself the Islamic State, had expanded to West Africa and congratulated "our jihadi brothers" there.
Since 2009, Boko Haram, whose name translates as "Western education is sin," has waged a campaign of terror aimed at instituting a stricter version of Sharia law in Nigeria.
Boko Haram's tactics have intensified in recent years, from battling Nigerian government soldiers to acts disproportionately affecting civilians -- such as raids on villages, mass kidnappings, assassinations, market bombings and attacks on churches and unaffiliated mosques.
Much of this violence has taken place in Nigeria. But neighboring countries, such as Cameroon and Chad, have also been hit increasingly hard and have committed troops to fight the militants.
An African Union-mandated Multinational Joint Task Force has also been formed, involving troops from Cameroon, Chad, Niger and Benin as well as Nigeria.
On Friday, the UK Foreign Office announced Britain
would provide 5 million pounds ($7.4 million) to help the task force tackle Boko Haram. Foreign Secretary Philip Hammond expressed hope that the United Nations Security Council would adopt a resolution, currently being negotiated, to endorse the task force.