By Julia Payne

ABUJA (Reuters) - Nigerian government forces recaptured the northeastern city of Bama from Islamist Boko Haram insurgents, the army said on Monday, a significant victory for the government just two weeks before a national election.

Boko Haram had held Bama, situated in Borno state where their six-year-old insurgency to establish a medieval-style Islamic caliphate has been centred, since September last year. Their campaign expanded over the past few months with cross-border incursions into Niger, Chad and Cameroon.

But counter-strikes launched by the armed forces of Chad and Niger over the frontier into Nigerian territory, particularly around Lake Chad, as well as the engagement of hundreds of mercenaries may have begun to turn the tides of the conflict.

The arrival of new equipment has also helped boost morale among hard-pressed Nigerian soldiers.

Africa's biggest economy and top energy producer has been plagued by the insurgency launched in 2009. Boko Haram managed to take control of territory the size of Belgium by the beginning of 2015.

The inability of the army to dislodge the militants, who have killed thousands of people and kidnapped hundreds, has been an embarassement for President Goodluck Jonathan.

"Nigerian troops have this afternoon routed terrorists from Bama in Borno state. Mopping up operation is ongoing," the Nigerian Defence Headquarters tweeted.

Bama is about 60 km (40 miles) southeast of the state capital Maiduguri. The army has been fighting for Bama since last week and began making headway over the weekend, security sources said.

The militants were progressively pushed out of neighbouring Adamawa and Yobe states since the start of the year, and cornered into an ever shrinking area of Borno, the heartland of the insurgency, where they appear to be suffering heavy losses.

But the Nigerian government has warned that the splintered militants would regroup and increase attacks on "soft" targets, something that has already occurred with a string of deadly bombings across the north and middle of Nigeria.

The elections were postponed in February by six weeks, with the military citing Boko Haram as warranting the delay.

Jonathan of the People's Democratic Party will face former military ruler Muhammadu Buhari, seen as tough on security, in the March 28 election, which is likely to be the closest ballot since the end of military rule in 1999.