It is an era of violence in the Middle East and North Africa, with nine civil wars now going on in Islamic countries between Pakistan and Nigeria. This is why there are so many refugees fleeing for their lives. Half of the 23 million population of Syria have been forced from their homes, with four million becoming refugees in other countries.

Some 2.6 million Iraqis have been displaced by Islamic State – Isis – offensives in the last year and squat in tents or half-finished buildings. Unnoticed by the outside world, some 1.5 million people have been displaced in South Sudan since fighting there resumed at the end of 2013.

Other parts of the world, notably south-east Asia, have become more peaceful over the last 50 years or so, but in the vast swathe of territory between the Hindu Kush mountains and the western side of the Sahara, religious, ethnic and separatist conflicts are tearing countries apart. Everywhere states are collapsing, weakening or are under attack; and, in many of these places, extreme Sunni Islamist insurgencies are on the rise which use terror against civilians in order to provoke mass flight.

Another feature of these wars is that none of them show any sign of ending, so people cannot go back to their homes. Most Syrian refugees who fled to Turkey, Lebanon and Jordan in 2011 and 2012, believed the war in Syria would soon be over and they could return. It is only in the last couple of years that they have realised that this is not going to happen and they must seek permanent sanctuary elsewhere. The very length of these wars means immense and irreversible destruction of all means of making a living, so refugees, who at first just sought safety, are also driven by economic necessity.

The world's main sources of refugees

Such wars are currently being waged in Afghanistan, Iraq, Syria, south-east Turkey,Yemen, Libya, Somalia, Sudan and north-east Nigeria. A few of them began a long time ago, an example being Somalia, where the state collapsed in 1991 and has never been rebuilt, with warlords, extreme jihadis, rival parties and foreign soldiers controlling different parts of the country. But most of these wars started after 2001 and many after 2011. All-out civil war in Yemen only got under way last year, while the Turkish-Kurdish civil war, which has killed 40,000 people since 1984, resumed this July with airstrikes and guerrilla raids. It is escalating rapidly: a truckload of Turkish soldiers were blown up at the weekend by Kurdish PKK guerrillas.

When Somalia fell apart, a process which a disastrous US military intervention failed to reverse in 1992-94, it seemed to be a marginal event, insignificant for the rest of the world. The country became a "failed state", a phrase used in pitying or dismissive terms as it became the realm of pirates, kidnappers and al-Qa'ida bombers. But the rest of the world should regard such failed states with fear as well as contempt, because it is such places – Afghanistan in the 1990s and Iraq since 2003 – that have incubated movements like the Taliban, al-Qa'ida and Isis. All three combine fanatical religious belief with military expertise. Somalia once seemed to be an exceptional case but "Somalianisation" has turned out to be the fate of a whole series of countries, notably Libya, Iraq and Syria, where until recently people had enough food, education and healthcare.

All wars are dangerous, and civil wars have always been notoriously merciless, with religious wars the worst of all. These are what are now happening in the Middle East and North Africa, with Isis – and al-Qa'ida clones such as Jabhat al-Nusra or Ahrar al-Sham in Syria – ritually murdering their opponents and justifying their actions by pointing to the indiscriminate bombardment of civilian areas by the Assad government.

What is a little different in these wars is that Isis deliberately publicises its atrocities against Shia, Yazidis or anybody else it deems its enemies. This means that people caught up in these conflicts, particularly since the declaration of Islamic State in June last year, suffer an extra charge of fear which makes it more likely that they will flee and not come back. This is as true for professors in Mosul University in Iraq as it is for villagers in Nigeria, Cameroon or Mali. Unsurprisingly, Isis's advances in Iraq have produced great waves of refugees who have all too good an idea of what will happen to them if they do not run away.

In Iraq and Syria, we are back to a period of drastic demographic change not seen in the region since the Palestinians were expelled or forced to flee by the Israelis in 1948, or when the Christians were exterminated or driven out of what is now modern Turkey in the decade after 1914. Multi-confessional societies in Iraq and Syria are splitting apart with horrendous consequences. Foreign powers either did not know or did not care what sectarian demons they were releasing in these countries by disrupting the old status quo.

The former Iraqi National Security Advisor, Mowaffaq al-Rubaie, used to tell American political leaders, who glibly suggested that Iraq's communal problems could be solved by dividing up the country between Sunni, Shia and Kurds, that they should understand what a bloody process this would be, inevitably bringing about massacres and mass flight "similar to the Partition of India in 1947".

Why are so many of these states falling apart now and generating great floods of refugees? What internal flaws or unsustainable outside pressures do they have in common? Most of them achieved self-determination when imperial powers withdrew after the Second World War. By the late 1960s and early 1970s, they were ruled by military leaders who ran police states and justified their monopolies of power and wealth by claiming that they were necessary to establish public order, modernise their countries, gain control of natural resources and withstand fissiparous sectarian and ethnic pressures.

These were generally nationalist and often socialist regimes whose outlook was overwhelmingly secular. Because these justifications for authoritarianism were usually hypocritical, self-interested and masked pervasive corruption by the ruling elite, it was often forgotten that countries like Iraq, Syria and Libya had powerful central governments for a reason – and would disintegrate without them.

It is these regimes that have been weakening and are collapsing across the Middle East and North Africa. Nationalism and socialism no longer provide the ideological glue to hold together secular states or to motivate people to fight for them to the last bullet, as believers do for the fanatical and violent brand of Sunni Islam espoused by Isis, Jabhat al-Nusra and Ahrar al-Sham. Iraqi officials admit that one of the reasons the Iraqi army disintegrated in 20014 and has never been successfully reconstituted is that "very few Iraqis are prepared to die for Iraq."

Sectarian groups like Isis deliberately carry out atrocities against Shia and others in the knowledge that it will provoke retaliation against the Sunni that will leave them with no alternative but to look to Isis as their defenders. Fostering communal hatred works in Isis's favour, and it is cross-infecting countries such as Yemen, where previously there was little consciousness of the sectarian divide, though one third of its 25 million population belong to the Shia Zaydi sect.

The likelihood of mass flight becomes even greater. Earlier this year, when there were rumours of an Iraqi Army and Shia militia assault aimed at recapturing the overwhelming Sunni city of Mosul this spring, the World Health Organisation and the UN High Commission for Refugees began pre-positioning food to feed another one million people who they expected to flee.

Europeans were jolted by pictures of the little drowned body of Alyan Kurdi lying on a beach in Turkey and half-starved Syrians crammed into Hungarian trains. But in the Middle East the new wretched diaspora of the powerless and the dispossessed has been evident for the last three or four years. In May, I was about to cross the Tigris River between Syria and Iraq in a boat with a Kurdish woman and her family when she and her children were ordered off because one letter spelling a name on her permit was incorrect.

"But I've been waiting three days with my family on the river bank!" she screamed in despair. I was heading for Erbil, the Kurdish capital, which aspired until a year ago to be "the new Dubai" but is now full of refugees huddling in half-completed hotels, malls and luxury blocks.

What is to be done to stop these horrors? Perhaps the first question is how we can prevent them from getting worse, keeping in mind that five out of the nine wars have begun since 2011. There is a danger that by attributing mass flight to too many diverse causes, including climate change, political leaders responsible for these disasters get off the hook and are free of public pressure to act effectively to bring them to an end.

The present refugee crisis in Europe is very much the conflict in Syria having a real impact on the continent for the first time. True, the security vacuum in Libya has meant that the country is now the conduit for people from impoverished and war-torn countries on the edges of the Sahara. It is from Libya's 1,100-mile coastline that 114,000 refugees have made their way to Italy so far this year, not counting the several thousands who drowned on the way. Yet, bad though this is, the situation is not much different from last year, when 112,000 made their way to Italy by this route.

Very different is the war in Syria and Iraq which has seen the number of people trying to reach Greece by sea jump from 45,000 to 239,000 over the same period. For three decades Afghanistan has produced the greatest number of refugees, according to the UNHCR; but in the past year Syria has taken its place, and one new refugee in four worldwide is now a Syrian. A whole society has been destroyed, and the outside world has done very little to stop this happening. Despite a recent flurry of diplomatic activity, none of the many players in the Syrian crisis shows urgency in trying to end it.

Syria and Iraq are at the heart of the present crisis over refugees in another way, because it is there that Isis and al-Qa'ida-type groups control substantial territory and are able to spread their sectarian poison to the rest of the Islamic world. They energise gangs of killers who operate in much the same way whether they are in Nigeria, Pakistan, Yemen or Syria.