The Nigerian president has said the military hopes to recapture towns seized by Boko Haram within a month, in what would be a swift victory after six years of bloody conflict.

But experts warned against any premature declaration of victory, with the militants still proving capable of carrying out deadly hit-and-run strikes and indications of coalition lapses.

Goodluck Jonathan, who is seeking re-election on 28 March, said Boko Haram was “getting weaker and weaker every day”. he told the BBC: “I’m very hopeful that it will not take us more than a month to recover old territories that hitherto have been in their hands.”

Nigeria has claimed major gains against the Islamists with the help of coalition partners Cameroon, Chad and Niger, achieving in just over one month what for years it had failed to on its own.

Two out of three of the worst-hit northeast states – Yobe and Adamawa – have been declared as cleared, while the third, Borno, is expected to be liberated soon, the military said this week. Major towns such as Bama and Dikwa are among 36 localities recaptured, with just three said to be still in rebel hands.

The national security adviser, Mike Omeri, said on Wednesday that “the final onslaught” was under way. More than 13,000 people have died in the conflict and the main opposition candidate, the former military ruler Muhammadu Buhari, has campaigned hard on the government’s security record.

Mark Schroeder, vice-president for Africa analysis at the security risk consultants Stratfor, said announcing victory before 28 March made political sense for Jonathan as part of the election campaign. “The risk he runs, however, is that the insurgency is not really defeated, only disrupted temporarily and for political posturing,” he said.

“It would be akin to the “mission accomplished” declaration by George W Bush in 2003, that was a premature symbol of victory in Iraq. Clearly, Iraq is still today struggling with an Islamist insurgency.”

Until this year, Nigerian troops had appeared unable – even unwilling – to tackle the better-armed militants, who have allied themselves with the Islamic State group in Syria and Iraq. Jonathan acknowledged that a lack of resources was to blame.

Nnamdi Obasi, senior Nigeria researcher at the International Crisis Group, attributed the sense of urgency to the prospect of defeat by Buhari. “That urgency facilitated the delivery and deployment of new military hardware, including assets more relevant to counter-insurgency operations,” he said.

Improvement had been seen in command and deployment structures, including the use of senior officers to lead combat operations, special forces and co-operation with local vigilantes.The involvement of foreign military contractors, many of them South Africans, to provide technical expertise may also have made a difference, he said.

“Offensives by the military forces of neighbouring countries have helped to overstretch the insurgents and thus undermine their ability to withstand Nigerian military offensives,” he added.

A Boko Haram attack on the border town of Gamboru on Wednesday and Thursday killed 11 civilians and gave an indication of the difficulties in bringing a definitive end to the violence. The incident highlighted possible co-ordination problems among the allies, as Chadian troops, who had recaptured the town, had withdrawn but were not replaced, according to residents.

The Nigeria Security Network of analysts on Thursday meanwhile warned that Boko Haram would revert to its guerrilla campaign of bombings and suicide attacks in the face of military pressure.

Fears remain about the safety of voters on polling day, after a spate of suicide attacks in the north in recent weeks and after Boko Haram’s leader, Abubakar Shekau, vowed to disrupt the election.