It is more than possible that before any Brexit deal is discussed, let alone concluded, the EU will have effectively collapsed. And the key factor could be the demise of Algeria’s leader of 17 years. President Abdelaziz Bouteflika is 79 and has needed a wheelchair since having a stroke in 2013. ‘His mind is even more infirm than his body,’ one observer tells me. Bouteflika returned home recently after a week’s stay at a private clinic in France. His prognosis isn’t good.

Officially, Bouteflika underwent standard ‘periodic medical tests’ in Grenoble. But no one believes this. Among people who know Algeria well, there is little doubt that he is severely incapacitated and does not have much time left. That means that his regime does not have much time left either. The consequences of that will stretch far beyond Algeria.

When Bouteflika goes, Algeria will probably implode. The Islamists who have been kept at bay by his iron hand will exploit the vacuum. Tensions that have been buried since the civil war will re-emerge. And then Europe could be overwhelmed by another great wave of refugees from North Africa.

Yet almost no one outside Algeria is remotely aware of what is about to happen. Other, that is, than western intelligence agencies. They may have been caught un-awares by the misnamed Arab Spring in 2011, but they are all too aware of what is on the cards in Algeria. Behind the scenes, governments are readying themselves for another civil war — and its consequences.

It was only 24 years ago that 150,000 died in an Algerian civil war between the Islamists and the state. This time, things will be far more bloody, not least because of the development of armed Islamism over the past few years.

Some observers have mistaken the decline in electoral success of Islamist parties as evidence of the decline of Islamism within Algeria. El-Islah, Ennahda and the Movement of Society and Peace have fractured and split. In the 2012 elections, they tried coming together as the Green Algeria Alliance but still managed to win only 48 out of 462 seats in parliament.

This is deeply misleading. Islamist leaders have switched tactics. Long ago they realised they cannot win through the ballot, so they have been using other means. As self-proclaimed guardians of public morality, they have campaigned to ensure the school curriculum is focused on ‘Islamic science’ and used their communal influence to try to stop the government changing the ‘family code’, which keeps women under the ‘guardianship’ of men. They have had fatwas issued demanding that ministries ensure women wear veils and men grow beards, and last year attempted — albeit unsuccessfully — to block a bill that criminalised violence against women.

Within the past few years, the veil has become normal in Algeria, with an estimated 70 per cent of women now wearing one (up to 90 per cent outside towns). And a billion dollars is now being spent building the largest mosque in Africa, in Algiers.

And this is all while the state successfully opposes formal Islamist influence. When President Bouteflika goes, it is clear that the Islamists — propelled by their brothers outside Algeria — will attempt to seize the day. Although you will struggle to find any mention of Algeria and its likely future direction in the press, European governments have been reflecting for months on what looks like a brewing crisis.

An Algerian civil war would create huge numbers of refugees. One analyst told me he expects 10 to 15 million Algerians will try to leave. Given Algeria’s history, they would expect to be rescued by one nation: France. In its impact on the EU, even a fraction of this number would dwarf the effect of the Syrian civil war. Given the political trauma that the refugee crisis has already caused in Europe, a massive Algerian exodus could cause tremendous insecurity.

Obviously, no one knows how long Bouteflika has left. Nor do we know how rapidly civil war could develop. But were the crisis to begin before the French presidential election next April, and were Algerian refugees to start appearing on French soil — neither scenario by any means impossible — it is hard to imagine anything more likely to hand victory to Marine Le Pen and the Front National.

Other, that is, than a further Islamist terror attack in France, which the French authorities already believe is extremely likely. It would become even likelier with a sudden influx of Algerian extremists. A Le Pen victory would make Brexit seem almost irrelevant, given her pledge to hold a referendum on French EU membership. With France pulling out, or Frexit, there could effectively be no EU for Britain to leave.

Of course, this scenario is predicated on a series of ifs. But even if only one or two come about, and even if Bouteflika doesn’t die until after the April vote in France, the consequences will be barely less dramatic. An Algerian civil war and the ensuing refugee crisis would shake France to the core. Whether it is Fillon or Le Pen in the Elysée, the French president (and his or her EU counterparts) would have to grapple with a crisis that could prove to be the EU’s final tipping point.