OUALLAM, Niger — By the time a U.S. Army Special Forces team arrived in Tongo Tongo last month — its last stop in an ill-fated mission — Islamist militants already wielded power and influence in the remote border village.
In a poor, barren region neglected by the state, the militants were at once the villagers' benefactors, employers, customers and unofficial police force, according to residents. The militants bought goats, cows and supplies at the market. They gave food to farmers whose crops had failed and recruited jobless youths by offering motorcycles and cash. They caught thieves and punished drug traffickers.
In return, the militants expected loyalty.
"The government can't protect us," said Mounkaila Alassane, the village chief. "That's why we collaborate with the jihadists."
A U.S. investigation is underway into the ambush by Islamist fighters that killed four American soldiers and five Nigerien troops on Oct. 4. It is certain to address issues such as whether they had adequate weaponry and a proper risk assessment.
Residents, Nigerien officials and analysts say it is clear that the U.S.-Niger team was operating in an area where many villagers sympathize with the militants or are forced to assist them. It is not clear how aware the soldiers were of the threat.
For U.S. troops supporting Niger's military, that bond between the villagers and the fighters may prove difficult to break.
It is the product of forces including poverty, altered weather patterns, and tribal and ethnic conflicts. There is an absence of state authority along Niger's long, sandy borders with Mali, Burkina Faso and Nigeria, and security forces in the area are ill-equipped.
"It's an asymmetrical war," said Hama Assah, a Nigerien lawmaker who heads the parliament's defense and security committee. "The enemy can see you. But you can't see the enemy."
Roughly 800 American troops are in the country, one of the world's most impoverished. Hundreds work on two drone bases in Niger. A third of the U.S. troops are Special Forces soldiers who train local forces.
American troops began arriving in 2012, when ethnic Tuareg people launched a separatist rebellion and seized much of northern Mali. The revolt was soon hijacked by al-Qaeda and other extremists. That triggered a flowering of militant groups across West and North Africa.
Arms and fighters from Libya's civil war have contributed to the crisis. Today, Niger is surrounded by countries where militant groups linked to the Islamic State or al-Qaeda are operating.
"We are in the middle of a fire, and the flames are everywhere," said Gare Amadou, a political analyst and journalist in Niger's capital, Niamey.
Nekanda Inoussa has been watching those flames slowly destroy his community. Over the past two decades, the Sahara desert has spread, consuming farming areas. The rainfall has been irregular, and the soil is so worn out that it cannot hold water. Every year, there are fewer crops, less food to eat.
"These are the effects of climate change," said Inoussa, deputy prefect of the Ouallam district, which includes Tongo Tongo. "At times, the rain doesn't fall. Other times it falls suddenly, destroying the crops. The food urgency is chronic."
In 2016, Niger ranked 187th out of 188 nations on the U.N. Human Development Index. Nearly half its 20 million residents live below the poverty line. It has one of the world's fastest-growing populations, putting further pressure on its economy. Niger has the highest rate of child marriages in the world — 3 out of 4 girls marry before 18.
The shrinking of grazing areas from desertification has increased tensions between pastoralists and farmers. The Fulani, a tribe of cattle herders, has been at the center of these disputes, which began more than two decades ago. Their grievances, and the inability of the government to solve them, have propelled many Fulani men to join Islamist militant groups in Mali.
"The Islamic State is using them to fight the state. They are using them like tools," said Diallo Aboubacar, a Fulani leader who has tried to mediate between the government and his tribe.
The Pentagon suspects that a relatively new Islamic State branch — the Islamic State in the Greater Sahara — is behind the ambush in Tongo Tongo. Nigerien officials say many Fulani youths have joined the group.
Most soldiers deployed along the Mali-Niger border do not speak the Fulani language, so the sides rarely communicate. "The big issue is the military doesn't trust the community and the community doesn't trust the military," said Aboubacar, who heads a livestock breeders association in the north Tillaberi region, where Tongo Tongo is located. "Most of the time, the military accuses the Fulani of helping the extremist groups."
In Tongo Tongo, poverty is rife, and residents have little hope of assistance from the authorities, according to Alassane, the village chief. "The government doesn't even come to see us, to ask how our kids are, if they are healthy or going to school," he said.
Niger's defense minister, Kalla Moutari, acknowledged in an interview that a key challenge for the government and its security forces is maintaining a strong presence along the long, sparsely populated border. But he and other Nigerien officials say the government is engaged and assisting the villages.
Criminals routinely cross the border from Mali, about 10 miles from Tongo Tongo, to prey on villagers. Drug trafficking is also prevalent. But with the Nigerien security forces spread thin, there's no law. The militants have filled the void.
"This is a very dangerous place," Alassane said. "When we need protection, we call on the jihadists. This is how we survive here."
The Nigerien police and military are constantly under pressure. Since February 2016, there have been nearly 50 attacks along the border, mostly against local security forces.
On Oct. 21, militants attacked a unit of the paramilitary police, known as gendarmes, about 30 miles from Tongo Tongo, killing 13 and wounding several others. As in the attack on the U.S. soldiers, the ambush was carried out by a large group of militants using machine guns, rocket-propelled grenades and other heavy weapons.
And as in other assaults, the extremists left with weapons taken from the Nigerien forces, adding to their arsenal.
"It's a region of many threats," said Moussa Idrissa, 26, a gendarme who was shot in the thigh in that attack and spoke from his hospital bed in Niamey. "Anything can happen. Any soldier can get attacked, not just the Americans."
He suspects that the locals provided intelligence to the extremists before the ambush. "The collaboration with the villagers is not as much as we'd like," Idrissa said.
Some of the militants who frequent Tongo Tongo speak Arabic. Others speak Fulani and some Malian languages.
They are not all welcome. While most pay for their purchases, others "take the food," said Adamou Boubacar, a villager.
"At times, they even kick you," he said. And they can do worse.
"They threatened me," Alassane said. "If I don't cooperate with them, they will kill me and my family. I have no choice — I have to cooperate with them."
Two days after the Oct. 4 ambush, Alassane called the Nigerien military. Some children tending cattle had discovered the remains of Sgt. La David Johnson, one of the four American soldiers killed.
The day after, Alassane was arrested on suspicion that he had collaborated with the Islamist militants. He was later released after the authorities found no evidence. Two villagers, he said, are still in prison facing charges of passing tips to the extremists.
"I don't give the jihadists information to kill our people," Alassane said. "Other people in the village also have the numbers of the militants."
The government is struggling to find solutions to contain the militancy. Authorities have shut down 16 markets in the border region to prevent the extremists from getting supplies. They have imposed curfews on the use of motorcycles and other vehicles. But the measures have deepened people's suffering and bred more resentment.
"When this area was not declared a red zone, the youth were using the motorcycles to do business," Alassane said. "Now they are jobless."
The militants recruited two villagers recently, Boubacar said, offering them $850 and motorcycles.
Conditions seem ripe for more such recruitment. The government has increased its defense spending next year to 17 percent of its budget, up from 10 percent two years ago. That means less funding for education, health and other programs to assist the population.
"If the poverty and food shortages continue, if the government and its allies don't do anything, the terrorists will recruit all of our youth," said Inoussa, the deputy prefect.