Nigeria's new army chief drove to the frontline of the war on Boko Haram and narrowly missed an ambush that killed one soldier and wounded two.

The ambushed advance team nonetheless gunned down five insurgents and arrested five on Friday's drive down the most dangerous stretch of road in Nigeria, from Maiduguri, the northeastern city where Nigeria's Islamic uprising was born, northeast to Ngala, on the Cameroon border.

The 140-kilometer (90-mile) ride took four hours with stops, including for soldiers to check for land mines.

An AP reporter in the 20-vehicle convoy drove past burned-out vehicles littering the road until recently controlled by the Islamic extremists. Weeds have overtaken villages once thriving with farmers and cattle herders.

Army chief Lt. Gen. Tukur Buratai stopped at Mafa to tell troops of the 112 Battalion to "keep on with the good job" of forcing out the insurgents and urging them on because "there is more work to be done."

A few kilometers down the road, soldiers with binoculars spotted insurgents hiding in a herd of cattle. Buratai called the convoy to a halt and soldiers arrested the militants, who said they had helped ambush the advance team.

Buratai ordered the body of the dead soldier and his two wounded comrades be conveyed to the nearest hospital.

Nigeria's military has said it has been plagued by leaked information from Boko Haram sympathizers in its ranks.

Corruption has robbed soldiers of pay and equipment, a problem the country's new president, Muhammadu Buhari, has promised to remedy.

Buhari was elected in March on a promise to crush the 6-year-old uprising that has killed 20,000 people and spilled across Nigeria's borders.

Buratai's trip was an example of the new regimen. He stopped to chat with 4,000 refugees camped in Dikwa town. They cheered him for bringing soldiers to save them after the extremists killed five of them on Thursday night.