Boko Haram jihadists are likely to step up cooperation with the Islamic State group should the latter gain a stronger foothold in Libya, a senior British official said on Saturday.

Boko Haram, which has been waging a seven-year insurgency in northern Nigeria, last year pledged loyalty to Islamic State group.

Little is known about the extent of cooperation. But Western officials worry that the Islamic State group's growing presence in North Africa and ties with Boko Haram could herald a push south into the Sahel region and create a springboard for wider attacks.

The Islamic State group first seized parts of Syria and Iraq but later built up a foothold in Libya, exploiting a security vacuum.

"If we see Daesh establish a stronger presence in Libya, that feels much more to people here like a direct communications route, that is likely to step up the practical collaboration between the two groups," British Foreign Minister Philip Hammond said at a security conference in Nigeria.

He was referring to a derogatory name of Islamic State group.

On Friday, a senior U.S. official said there were signs of Boko Haram fighters going to Libya from Nigeria, crossing via porous Sub-Saharan borders.

"The intent is clearly there, the evidence of hard collaboration is still pretty sketchy," Hammond said about the cooperation between the two groups.

At the conference attended by Nigeria's neighbours and Western powers, several African leaders warned stability in lawless Libya was key to fighting Boko Haram and improving security in the region.

In a speech, Nigeria's President Muhammadu Buhari said the army had almost recaptured all territory it had lost to Boko Haram, though the group still often stages suicide bombings.

"What remains is to dislodge the terrorists from their hideout in the (northeastern) Sambisa forest and safely liberate the Chibok girls and other victims of abduction," he said.

He was referring to a group of 219 schoolgirls kidnapped by Boko Haram in the Nigerian town of Chibok in 2014.

Buhari also said the Nigeria's army was respecting human rights when dealing with civilians, a condition from the U.S. to fulfil requests to sell it aircraft and other arms.

Under Buhari's predecessor Goodluck Jonathan, the United States had blocked arms sales, partly due to human rights concerns.

U.S. officials told Reuters this month Washington wants to sell up to 12 A-29 Super Tucano attack aircraft to Nigeria but Congress needs to approve this.