By Joe Bavier

DIFFA, Niger (Reuters) - Unlike many victims of Islamist violence fleeing to Europe, Aba Ali found a warm African welcome closer to home. But even in southern Niger, where a local family accepted him as a brother, hospitality for refugees is now reaching its limits.

Ali, a 45-year-old mechanic, lost his home in neighboring Nigeria two years ago when he fled Boko Haram fighters who massacred his friends and neighbors.

Crossing into Niger, the world's fifth poorest nation, he became one of the many refugees living with local people who themselves often have barely enough to feed their own children.

A surge in violence since last month, however, has displaced tens of thousands more, testing that spirit of open-armed acceptance in Niger's Diffa region as shortages of food and water put communities under severe strain. Competition for scarce resources is creating friction and the risk of ethnic unrest.

Ali found a degree of security in Diffa, a region of blazing hot sand dotted with sparse trees and donkeys, thanks to Adamu Moumouni, a stranger who took him in when he had nothing.

"He became my family," said Ali, tears streaming down his cheeks. "If it wasn't for him, I would have no one here," he added, his words barely audible over the bleating of goats on a small nearby plot of land that Moumouni gave him.

The United Nations says 2.4 million people have been displaced by Boko Haram's seven-year campaign to establish an Islamic emirate which has spilled over Nigeria's borders into Niger, Chad and Cameroon.

Ali's lasting memory of his home village of Malam Fatori in northeastern Nigeria is his elderly mother standing in the doorway as gunfire rang out. "She told me 'Run! Run!'" he said.

He escaped, helped by a fisherman from Niger who ferried him across the river that forms the border between the two countries. From there, he watched helplessly as Boko Haram drove those still waiting on the far bank into the water.

"I saw women enter the water with babies on their backs, and when they reached the other side the babies were gone," he said.

Ali's two wives and five children survived and also got to Diffa, but he lost 19 friends the day he fled. His mother, who was in poor health, made it to Niger a year later, only to die after a few days.

"SUFFERING BROUGHT US TOGETHER"

When he arrived in Diffa, Ali was a broken man. Then he met Moumouni.

"It was the suffering that brought us together. What happened to them could happen to us," Moumouni said.

Since then, members of the two men's families have married and they've even named babies after each other.

Unlike Ali, some fleeing Boko Haram push on through Niger for Europe, making the dangerous journey across the Sahara and Mediterranean among an estimated 150,000 this year - some escaping violence, others simply seeking a better life.

In the wealthy nations of Europe, their reception has been mixed. Germany received one million migrants last year from Africa, the Middle East and Asia. But the number of arson attacks on migrants' hostels there has shot up while Chancellor Angela Merkel's open door policy has come under heavy fire.

Other European nations are trying to stem the flow, saying they cannot cope, while countries on the separate Balkan migrant route have halted it by erecting border fences.

CRACKS FORM

In Niger, Diffa is hosting a quarter of a million people - more than one in three of the population - displaced by the insurgency. They include more than 80,000 Nigerians like Ali, who have been largely taken in and helped by local residents rather than accommodated in bleak refugee camps.

"People have a sense of collectivity," Nigerien Interior Minister Mohamed Bazoum told Reuters. "It's characteristic of Africa."

But Diffa's economy, once among Niger's most robust, is in ruins. Boko Haram stalks the river border, which has been evacuated by the government, killing off a once lucrative fishing industry and leaving precious irrigated farmland fallow.

The security situation is only getting worse. On June 3, Boko Haram fighters launched one of their most daring raids yet on Nigerien soil, briefly seizing the town of Bosso in the southeast and killing 32 soldiers. 50,000 civilians fled.

After arriving in 2014, Ali found work in Diffa fixing motorcycles, but then they were banned to prevent attackers using them to make a getaway. Moumouni, a mason, began bringing him along to construction sites but now few people are building due to the constant threat of violence.

And still more people are fleeing. "More displacement means less capacity to absorb those displaced," said Arjika Barke, International Rescue Committee coordinator in Diffa. "There are now areas that are saturated."

This is raising tensions. Deadly violence broke out last month in one village between nomadic Fulani herdsmen and members of the Buduma ethnic group, who left their Lake Chad island homes last year following Boko Haram attacks there.

The cause was a dispute over access to a well being used by both displaced villagers and livestock.

"These groups lived together in peace before," said Lamido Souley Mani Orthe, a Fulani chief.

The government is drilling more wells to defuse tensions, but Aboubacar Halilou of the conflict resolution charity Search for Common Ground says risks are growing as resources become increasingly scarce. "Both sides are arming now. Boko Haram and ethnic fighting - the two conflicts are linked," he said.

Still, those with the least to offer stand ready to help.

Since the Bosso attack last month, Ali has let 45 new arrivals camp on the dusty ground of the courtyard Moumouni gave him. "These people who are here, we are obliged to care for them," he said. "We can't not help them."

(Editing by Tim Cocks and David Stamp)