Maiduguri, Nigeria — Dozens of drivers lined up in beat-up vehicles stuffed with mattresses, cooking pots and other belongings, clogging a road outside one of the most desperate and dangerous camps that serve as refuge from the war with Boko Haram.
All were waiting for the Nigerian military to escort them back to the farms and the villages they had fled during the yearslong rampage by the insurgents here in this northeast corner of the nation.
The military and the government have proclaimed that the countryside outside Maiduguri, the busy Borno State capital where Boko Haram was born, is mostly safe now. They’ve said it’s time for most of the nearly two million displaced people — many of them farmers and fishermen fighting to stave off hunger — to go home.
But the soldiers were guiding the throngs of people into a future that was no more certain, and potentially just as dangerous, as the past they had fled.
President Muhammadu Buhari has repeatedly declared the war with Boko Haram over. The military has chased the insurgents from hiding places in the forest. But the radical terrorist group is still waging deadly attacks across the countryside. And in some camps for displaced people, new arrivals fleeing the militants are moving in even as others are moving back home.
Caught in the middle are people like Idi Hassan and his wife, who were in the convoy with six of their young children in his truck bed. The Hassans had been living for two years in the squalid camp in Maiduguri, relying on food handouts and eager to get back to their farm north of here, where they hoped to make a living.
“The area has been liberated, and we’re going home,” Mr. Hassan said.
Yet insurgents still roam the northeast and frequently crisscross roads like the one that was taking Mr. Hassan and his family home. Just weeks ago, Boko Haram ambushed soldiers along this very highway, killing seven of them.
The narrow road is also the same one that Boko Haram used in January to ferry nine suicide bombers who set upon the same camp in Maiduguri that the Hassan family was leaving. Besides the bombers, two other people were killed in the attack, described by the authorities as the most coordinated of recent bombings.
Much of the world associates the militants with the kidnapping in April 2014 of more than 200 schoolgirls from Chibok, a small village in northeastern Nigeria. Many of them are still missing.
“Most people simplify this crisis into one hashtag: Bring Back Our Girls,” said Sean Hoy, Ireland’s ambassador to Nigeria, who was in Maiduguri recently with other diplomats to assess the humanitarian crisis. But the aftermath of the ravaging by Boko Haram is far more complicated.
Since the violence started here in 2009, nearly two million people in northeastern Nigeria have fled their homes in fear of Boko Haram, which has carried out a murderous spree against civilians and members of the military.
Many people fled rural areas to Maiduguri, which has doubled in size as displaced Nigerians have crowded into relatives’ homes or settled into crumbling buildings, bus stations, schoolyards and the thousands of ramshackle thatched huts that dot the edges of the city.
The Borno State government announced plans to close the camps in Maiduguri by the end of May, but said it would keep evaluating the situation. Now, one million uprooted people are making their way back home, according to the United Nations.
Outside the city, military commanders say, all but small pockets of the countryside are now safe.
“Ferocious attacks are a thing of the past,” said Maj. Gen. Leo Irabor, the Nigerian Army commander leading the operation against the militants. “We are only picking up the pieces.”
In late December, the military began reopening main highways that had been closed for years because of security worries. The state government has started rebuilding burned villages.
The military push has allowed aid workers to fan out into new parts of the countryside to help people ravaged by famine or famine like conditions. The United Nations has increased its efforts as well, working alongside the military and asking for $1 billion to help those affected by Boko Haram.
Yet the security situation is far from stable. Maiduguri, where soldiers chased out the militants years ago, has been a frequent suicide-bombing target, set upon even by girl bombers, one as young as 7. One bomber in a recent attack had a baby strapped to her back.
With the military on their trail, many Boko Haram fighters appear to have scattered throughout Borno State and its beige landscape dotted by tiny farming communities. The Nigerian Army orders residents to clear out as it hunts the militants, and unarmed civilians are sometimes killed in the battles.
In another area deemed safe by the military, insurgents gunned down 16 people gathering wood not far from their homes. When aid groups make some supply runs in helicopters across the safe areas, the pilots fly high enough to be out of missile range.
The New York Times