Updated

Baba Inuwa was pleased to move back to his vegetable farm in Nigeria's northeast, encouraged by the military's offensive against Boko Haram, the country's homegrown Islamic extremist rebels and by President Muhammadu Buhari's claim that the insurgency had been crushed.

"We thought all was over and Boko Haram can never return," Inuwa said. He joined thousands of others in leaving displacement camps to return to their homes.

But then last month the extremists rolled into Inuwa's hometown, Baga, firing into the air, hoisting flags and claiming it as their own. Suddenly residents were on the move again, fleeing with little more than the clothes on their backs. On a punishing two-day march through the arid Sahel, some pregnant women miscarried and other elderly people died.

Nigeria's government now acknowledges an extremist resurgence, this time by a Boko Haram offshoot, the Islamic State West Africa Province, the IS group's largest presence outside the Middle East, estimated to have more than 3,000 fighters. Their near-daily attacks have many traumatized Nigerians questioning whether they can vote for Buhari as he seeks a second term.

Others question how the elections can be held in the troubled northeast region. The National Assembly has approved a record $147 million for election security but some polling workers in remote areas have rejected their posts in fear of being attacked. The opposition objects that voting will be held in government-controlled camps, which in "liberated" communities are the safest locations.

Buhari, a former military dictator, returned to power in 2015 with an election victory in which he promised to tackle insecurity, corruption and the economy in Africa's most populous country with 190 million people. While he still has support in most states of his native north, enthusiasm has dimmed as it becomes clear that the decade-old extremist insurgency — killing more than 27,000, abducting hundreds of schoolgirls, displacing millions — is far from over.

Up against Atiku Abubakar, a fellow northern Muslim and former vice president, Buhari could end up like former President Goodluck Jonathan, who lost in 2015 after his failure to stop extremism.

At first, Nigeria's military appeared to deliver on Buhari's inaugural vow to eliminate Boko Haram, pushing fighters out of many communities. Residents were urged to return home.

But late last year the Islamic State-linked extremists roared back, attacking military bases, resupplying and causing a rare government admission of dozens of soldier deaths. Shaken, officials said the extremists had begun using drones, indicating links with ISIS fighters fleeing collapsing strongholds in Syria and Iraq.

"ISIS now has a strong foothold in West Africa, with Nigeria in the forefront of the battle," Information Minister Lai Mohammed declared last week. The fighters are more worrying than Boko Haram and at least triple its size, the U.S. Africa Command chief has said.

Some 59,000 people have fled attacks since November, the U.N. migration agency says. The now-deserted border town of Rann was hit twice last month, with humanitarian centers vandalized or burned. Aid workers fled. Five hid in a septic tank and survived.

As many as 39 attacks were recorded in Borno and Yobe states last month, the U.N. refugee agency says.

In early January the extremists captured Baga, near shrinking Lake Chad. They overran the nearby military camp and announced that people who wished to stay in peace could do so. Many residents, remembering past attacks, didn't buy it.

"We felt all was not well," Inuwa, the farmer, told The Associated Press. He now shelters again in Maiduguri, Borno state's capital, which already hosts more than 1 million displaced people.

The extremists still hold Baga, he said, citing residents who went back to retrieve their valuables. Fighters searched them at the edge of town before allowing them to enter.

Inuwa said he was not impressed with the president's performance on security but might support him anyway: "I'd rather vote for him so that he can build upon the foundation he has already laid."

Another Baga resident, Abba Mustapha, said the extremists' arrival met little resistance, reflecting concerns about government support for troops.

"We were running for our dear lives and the soldiers who were armed to protect us were even ahead of us fleeing," he told AP.

Now Mustapha is back in Maiduguri, seeking aid and finding little. Frustration is high. The spike in arrivals was so sudden that some people last month slept on the streets, finding no space in camps.

Falmata Modu said she was happy she grabbed her voter card when she fled Baga. She voted for Buhari in 2015. Not this time.

"I still cannot overcome the pain of running with some of my grandchildren who were crying for water and asking why we were in the bush," she said. "It is sad that I could not answer."

___

Anna reported from Johannesburg. Associated Press writer Carley Petesch in Dakar, Senegal contributed.

___

Follow Africa news at https://twitter.com/AP_Africa