Dr Daniel Woker is the former Swiss Ambassador to Australia and now a Senior Lecturer at the University of St Gallen.

It took the presidential elections of 28 July in Mali (now entering a run-off phase) to bring the western frontier of the Islamic world to the attention of the world's media again. Yet not only Mali, but also Morocco, its neighbour Algeria and the little known country of Western Sahara (a big part of which remains occupied by Morocco) are all potential flashpoints on the western fringe of an Islamic world in turmoil.

To start with Mali, the elections have the one basic purpose of restoring a semblance of constitutionality and thus giving international donors the opportunity to start reconstruction.

In parallel to some €3 billion in civilian assistance, mainly from Europe, there are frantic efforts to stabilise the security situation. Following a UN Security Council resolution, since 1 July MINUSMA (Multidimensional Integrated UN Mission for the Stabilization of Mali) has taken over responsibility from the French Expeditionary Corps to help Mali guard its territory. As well as various African countries, Bangladesh, China, Norway and Sweden have pledged sizeable military and police contingents. At least 1000 French elite troops, helped by US surveillance and targeting drones, remain 'in case of serious menace to the UN mission', presumably in the volatile north of the country.

There is also a European Union Training Mission (EUTM-Mali) hard at work to bring the Malinese Armed Forces (MAF) up to par, both militarily but also with regard to acceptable behaviour towards its own civilian population. In 2012 the MAF was good enough to remove by coup the last democratically elected president of Mali, but turned out to be far too underequipped, undertrained and corrupt to prevent the joint Islamist-Tuareg advance from the north, which would have swept into the capital Bamako if not for the French intervention.

Compared to other north African countries, from Egypt to Algeria, Morocco so far has been the lucky one with regard to widespread bloodshed in the wake of the Arab Spring. Yet as a visitor I was struck by the evidently deep cleavage between observant, strict Muslims on the one hand and secular minded Muslims on the other. Nowhere is this more evident than in the tourist hotspots.

In Marrakesh's medina (old town) no alcohol is served in any but a few five-star hotels, and restaurants are closed by 9pm, when everybody seems to turn in. Thus evenings in and around the many 'riad' (traditional houses, many of them turned into hotels and B&Bs) of the medina are dark and quiet. Not even traditional Arab music, let alone Western pop, can be heard in the narrow streets where at most a lady, black clad from head to toe, swishes by like a ghost.

The story is totally different just a couple of kilometers away in the large 'European' part of town. Dinner starts at 9pm (albeit with a young 'sommelier' who confessed, after having given expert advice on local wines, to be a teetotaler for religious reasons), then on to a show, grandiloquently advertised as the 'hottest strip in town', where a lot of female skin (not the full Monty though) is on display accompanied by thumping electro beats for a distinctly local and gender-mixed audience.

It's difficult to say how and when these worlds will collide but equally difficult to imagine they won't.

Unlike its Maghreb neighbours, Morocco has a king with impeccable religious roots. As we know from the Gulf, this alters the pattern of revolt, repression, revolution and then further turmoil between different sectors of society witnessed in recent years in other Islamic countries.

Just like the Gulf monarchs, the Moroccan kings have never hesitated to defend their 'God given' right to decide their country's fate alone. There was King Hassan II in 1975, who ordered a non-military invasion of Morocco's southern neighbour Western Sahara upon the retreat of the Spanish colonial power. And in May this year, his son, Mohammed VI, torpedoed an equitable UNSC solution which would have finally allowed MINURSO to do its work. This UN body is charged with the execution of a referendum on full sovereignty or autonomy within Morocco for the Sahrawis, whose phantom state, the Sahrawi Arab Democratic Republic, is a member of the African Union.

This particular example of royal Moroccan intransigence and high-handedness is a problem for Algeria, where many Sahrawi refugees have vegetated for 20 years under pitiful circumstances, mostly in the Southern province of Tinduf. Algeria is a country still numb from its own traumatic experience with an Arab Spring which turned into a ten-year civil war between secularists and the army on the one hand and the Islamists on the other.

Both this war and the continued Moroccan occupation of a big part of the Western Sahara have left a heavy legacy: a reservoir of embittered, often jobless young people who are easy prey for Islamic fanatics and terrorists, both homegrown and imported. When the two join forces, like in the case of al Qaeda in the Islamic Maghreb, they are ready and able to leave a trace of blood soaked terrorism and outright war, as in the case of northern Mali.

This is of course why the international need to act is so urgent. The French-led intervention in Mali, the American buildup of strategic counter-terrorism potential in places like Niger and the growing realisation within the EU that Europe will have to do more for security in its near-abroad all need to be seen in light of a possible worst-case scenario: the Sahel zone from Somalia through to the Atlantic as a belt of failed and failing states, unable or unwilling to prevent sanctuaries for terror, as well as massive trade of people and illicit goods.

Where does that leave Africa, the continent of the (eternal) future? At the height of the conflict in Mali, a UN high official from Cameroon, Sammy Kum Buo, put his finger where it hurts: the continent needs to assume the driver's seat to prevent or resolve African conflicts.

There is reason for hope. I found exactly the right Mali-related story to prove Kum Buo's point: contrary to initial claims, a big part of the priceless historical manuscripts in Timbuktu was, it turns out, saved from wanton destruction by invading Islamist fanatics, thanks to courage and guile by the professors and librarians of the Ahmed Baba Institute in this medieval centre of higher learning in the north of Mali.

Photo courtesy of the French Defence Ministry.