As the conflict in Darfur spreads across central Africa, with thousands more displaced and killed, Julian Borger in Chad investigates the origins and contradictions of what is likely to be seen as the first climate change war

In the relief camps scattered around the Chad-Sudan border, the refugees from Darfur tell the same story - of an ancient shared way of life catastrophically lost.

Less than a generation ago, Arabs and Africans coexisted peacefully and productively in Darfur, Sudan's arid western province which is more than twice the size of the United Kingdom. African farmers had allowed Arab herders to graze their camels and goats on the land, and the livestock had fertilised the soil.

The coexistence was so natural, in fact, the tribes of Darfur did not even think of themselves as Arab or African. It is only now, in light of the bloodshed of the past four years, that they look back and affix ethnic titles to the protagonists in their story, with all non-Arabs claiming the title African. Only a few years ago, it was just nomads and farmers.

"There was never any big problem between the livestock herders and the people living in the village," Yacoub Adam Omar, a 38-year-old refugee from Darfur, told me.

"Some of my own tribe would even travel with the Arabs when they went north into the desert in the rainy season and back in the dry season. And if the Arabs had heavy baggage they would leave it with us until they came back."

But here was Omar sitting in a refugee camp along with two million of his fellow Darfurians after being ethnically cleansed from their homes by Arab militia, the Janjaweed. UN officials now believe 400,000, mostly African civilians, have been killed.

Something fundamental has changed in this part of Africa, and it happened within a generation. From a state of sectarian innocence in which the dividing line between Arab and African was meaningless, something made people pick sides, and hardened their new sense of identity into ethnic hatred, all in the past two decades. What changed, the evidence suggests, was the climate.

The current conflict began in 2003. It was triggered when Darfurians launched a revolt against the central government, which fought back by unleashing the Janjaweed.

But the real roots of the disaster stretch back to the mid-1980s when a ferocious drought and famine transformed Sudan and the whole Horn of Africa. It killed more than a million people and laid waste livestock herds. Whether they maintained their way of life or tried to take up settled cultivation, the pastoralists of Darfur clashed repeatedly with its farmers. A string of conflicts broke out as both sides armed themselves, and those conflicts created the template for today's disaster.

Alex de Waal, a researcher and writer on Darfur, tells the story of meeting a nomadic leader, Sheikh Hilal Musa, in 1985, at the height of the drought. The desert was visibly advancing as the Saharan winds blew sand into the more fertile hills where the sheikh's clan, the Jalul, were grazing their camels. He tried hard to keep up appearances but it was clear his world was falling apart. Many Jalul who had lost their camels and goats tried their hands at farming, but as latecomers with no ancestral land rights, they had to make do with rocky semi-barren terrain, and could only look with envy towards the rich alluvial soil belonging to the long-established African tribe, an offshoot of the Fur people. Darfur means literally the Land of the Fur.

De Waal recalls: "Sheikh Hilal's moral geography had been disturbed: the cosmic order had given way to chaos."

Two decades later, the sheikh's son, Musa Hilal, is the supreme leader of the Janjaweed - and he is also top of the US state department's list of war crimes suspects.

There are, of course, other factors in this transformation from peaceful nomad to war criminal in the space of one generation. Leaders in the region have sought to turn hardship to their advantage. Libya's Muammar Gadafy formed an Islamic Legion out of West African Tuareg nomads and disgruntled Arabs from across the Sahel, and used them to try to carve out an "Arab belt" across Chad and into Sudan under his sway. His forces were soundly beaten by the Chadian army in 1987, but numbers of the legionnaires hung around the area - armed, trained and imbued with ideas of Arab supremacism, looking for the next fight. Many are now leading Janjaweed raiders into battle. There is an unpleasant sense of irony to Gadafy's recent insertion of a token "observer" force along the Chad-Sudan border, as the Libyan leader plays the role of regional peacemaker.

When it comes to manipulating ethnic frictions to cynical political ends, however, no one can outdo the government of President Omar al-Bashir in Khartoum. After years of neglect in which the central government starved the region of funds, Darfur erupted in a revolt in 2003. At the time, Sudan's army was exhausted from 20 years of war in the south, and rather than embark on a separate power-sharing venture with the people of Darfur, Khartoum opted for a cut-price means of suppressing the rebellion - subcontracting it to the Janjaweed. The Bashir government armed the militia, reinforced them with Arab convicts and pumped them up with a booster shot of Arab supremacist ideology.

But Khartoum would never have found willing partners in Darfur if the conflict over land had not been made so acute by the drought. Tellingly, those Arab tribes who had land ownership rights - mostly in the south of Darfur - chose not to join the government's counter-insurgency. Those who were prepared to kill, rape and pillage were drawn from the ranks of the desperate, ripped from their traditional way of life by a catastrophic change in the weather. Global warming created the dry tinder. Khartoum supplied the match.

Back in the 1980s, the failure of the rains was widely blamed on the people who lived in the region. Their over-grazing, it had been thought, had led to soil erosion, replaced green cover with bare rock and sand, reflecting more heat into the atmosphere and diminishing the chance of rain.

More recent computer modelling has suggested that rain patterns over Africa are influenced rather by ocean temperatures, and those in turn reflect global warming, and the rise of greenhouse gases in the atmosphere. In other words, droughts in Africa may be caused less by its hapless inhabitants and more by oversize cars and cheap flights in Europe and the US.

The implications are far-reaching. On top of all the economic and ecological implications of global warming, there is the very real prospect it will lead to more conflicts like Darfur, as groups who have coexisted until now begin to feel a sense of urgency over the diminishing resources of water and land.

The conflict has already shown its capacity to spread. Over the past year, it has colonised eastern Chad, where it has inflamed a struggle inside that country's ruling elite over staggering new revenues from oil exports. The Sudanese and Chadian governments suspect each other of destabilisation - a self-fulfilling fear as they are both hosting, training and arming anti-government rebels in each other's countries in a bid to pre-empt the threat. In these circumstances, long-festering antipathy between the Tama and Zaghawa tribes - who have been pushed together at the border by the instability all around them - has the potential to ignite into an extremely bloody brawl.

At the same time, Arab raiding parties have made an appearance in the northern tip of the Central African Republic, which also accuses Sudan of sponsoring the attacks.

There is endless potential for more climate-driven conflicts all across the broad Sahel region that stretches from Sudan to Senegal, where the competition between herder and farmer is often reinforced by more entrenched tribal differences, as well as the fault line between Muslim and Christian. In decades to come, Darfur may be seen as one of the first true climate-change wars, and those wars to come may be every bit as vicious because the adversaries will be fighting for their lives in a suddenly unfamiliar world.

It is a doom-laden scenario but it is not inevitable. Most scientists agree that climate change, of one degree or another, will happen, and that it will diminish the amount of fertile arable land and pasture across vulnerable regions like the Sahel. What is not inevitable is the descent from competition to armed conflict. That is a political leap. It requires that national governments choose to exacerbate conflicts rather than resolve them, and it requires that the international community fails to act when national governments do not protect their own citizens.

"The real problem here is moral, it is not a question of climate," Said Ibrahim Mustafa, the sultan of the Chadian border region of Dar Sila, says. "It's not just a lack of water that makes a man kill his brother."

At the moment, people such as Mustafa are losing the battle. After criticising the N'Djamena government for handing out guns rather than attempting to defuse border tensions with Sudan, he was obliged to hand over formal authority to his less outspoken son.

But there are still some reasons for hope in such a dismal environment. Some of the Arab groups, such as the northern Rizigat, who have hitherto ridden in the Janjaweed, are showing signs they are fed up with fighting, particularly since the Sudanese army withdrew to barracks in 2005 - its generals had begun to fear that they would be convicted of war crimes, and so left the Janjaweed to fight Darfurian rebel groups on their own. In some areas, Arab tribes have even mutinied. In late 2005, they occupied government buildings in the western town of El Geneina and, according to a western official in the country, told a provincial government representative: "You have led us on the path to destruction."

The fragmentation of the Janjaweed will make Khartoum nervous, and more likely to bow to international pressure to accept a substantial UN peacekeeping force. That force would bolster a small ineffectual African Union contingent that has served as an international figleaf until now. The trouble is any UN force now will arrive too late to save many lives. The crime has already been committed.

UN peacekeepers, however, would be useful if they were sent in to implement a real peace agreement, in which Khartoum agreed to share power and the Sudan's unexploited oil reserves.

The rebels and the government came close to a deal last year but by the time a deadline for the negotiations expired, only one rebel faction had accepted the terms Khartoum was offering. The Darfur groups are in disarray, but if they were to reassemble around a common platform they may find Khartoum - facing mounting sanctions - willing to make a better deal.

While that inevitably slow process is underway, the best place for UN peacekeepers to save lives would be around the outer edge of the crisis, in eastern Chad. Efforts are being made to convince the Chadian government of President Idriss Deby to host that force. That may in turn open the way to negotiations with Chadian rebels.

There are ways that Darfur's tragedy can be contained and mitigated before its neighbours are pulled into the downward spiral. The alternative could be a chain of conflicts across the continent and beyond, in the struggle for survival on a changing planet.