In the late afternoon of 27 March 2007, I was travelling on the Paris metro, heading home after a day's work in the east end of the city. I got off at the Gare du Nord to change trains. In a trance – lost in the music on my headphones – I automatically made for the shopping mall which connects the upper and lower levels of the station. This was where I would normally buy a newspaper and a coffee and then catch a train south to my flat.

But this was no ordinary evening. As I walked up the exit stairs I could smell smoke and hear shouting. The corridors were a tighter squeeze than usual and everyone a little more nervous and bad-tempered than the average rush-hour crowd. As I got nearer the main piazza of the mall, smoke stung my eyes and nostrils, and the shouting grew louder. I could see armed police and dogs. Still, there didn't seem to be too much to worry about. My only real fear was how to get through the tide of commuters, which by now had come to a dead halt, and on to my train home.

I pushed my way through the crowd, burst into the empty piazza, and found myself in dead space, caught in a stand-off between two battle lines – on one side police in blue-black riot gear, drumming batons on their clear, hard shields, and on the other a rough assembly of kids and young adults, mainly black or Arab, boys and girls, dressed in hip-hop fashion, singing, laughing, and throwing stuff. You could tell from their accents and manners that these were not Parisians; they were kids from the banlieues – the poor suburbs to the north of Paris, connected to the city by the trains running into the Gare du Nord. One African-looking kid was swinging an iron bar and shouting. The bar crashed into a photo booth and a drinks machine. A few yards further on, a fire had been started in a ticket office.

The atmosphere was strangely festive. Behind the reinforced steel and glass of the Eurostar terminal, new arrivals from London were ushered into Paris by soldiers with machine guns – the glittering capital of Europe now apparently a war zone. They looked on the scene with horror. But it was exhilarating to watch kids hopping over metro barriers, smoking weed and shouting, walking wherever they wanted, disobeying every single one of the tight rules that normally control access to the station. It was also frightening, because these kids could now hurt you whenever they wanted. They had abolished all the rules, including the rule of law.

Over the next few days, I read the press. Most reporters and eyewitnesses agreed on the chronology. At half past four in the afternoon, a young Congolese man, already known to the police, had been arrested while trying to dodge the ticket barrier. The arrest was heavy-handed and as the cops started hammering the guy, passers-by waded in to support the underdog. Guns were pulled out, batons drawn, and soon enough a riot was in full swing.

But how did this happen? What made the Gare du Nord such a powder keg that the arrest of a ticket dodger could, within minutes, make it the most ungovernable part of French territory? This is where the interpretation of events became confused. In the pages of Le Parisien, the chronicle of daily life in the city, the events were described as "une émeute populaire" (a popular riot). The tone was one of mild approval. Le Parisien is not particularly left-wing, but it is always on the side of the "people" – that most cherished of Parisian myths. This language placed the events at the Gare du Nord in a long tradition of popular uprisings in the city – from the days of La Fronde through to the French Revolution and the Commune, these have been a defining feature of Parisian history. Several other newspapers, including the right-wing Le Figaro, reported the same facts with a shiver of horror, adding that the crowds had been chanting "A bas l'état, les flics et les patrons" ("Down with the state, the coppers and the bosses"), thereby domesticating the riot as part of the Parisian folklore of rebellion.

But the problem was that none of these accounts was true. The kids I saw didn't give a fuck about the state or the "bosses". Most of them didn't have jobs anyway. And although they did hate the police, they would never have used an old-fashioned slang word like flics, which belongs to the Parisian equivalent of the Krays' generation. For the rioters, the police were either keufs or schmitts. The chanting I heard was mostly in French: "Nik les schmitts" ("Fuck the cops"), and sometimes in English: "Fuck the police!" But there was another slogan, chanted in colloquial Arabic, which seemed to hit hardest of all: "Na'al abouk la France!" ("Fuck France!"). This slogan – it is in fact more of a curse – has nothing to do with any French tradition of revolt.

These days France is home to the largest Muslim population in Europe. That includes more than 5 million people from North Africa, the Middle East and the so-called "Black Atlantic", the long slice of West Africa which stretches from Mali to Senegal. A short walk around the Barbès district in northern Paris, where almost all of these nationalities are represented in the same tiny, overcrowded space, provides both a vivid snapshot of the diversity of this population and a neat lesson in French colonial history

The Gare du Nord, at the heart of this district, is frontier territory. It is the dividing line between the wretched conditions of the banlieues, the suburbs outside the city, and the relative affluence of central Paris. It is where young banlieusards come to hang out, meet the opposite sex, shop, smoke, show-off and flirt – all the stuff that young people like to do. Paris is both near and distant; it is a few short steps away, but in terms of jobs, housing, making a life, for these young people it is as inaccessible and far away as America. So they cherish this small part of the city that belongs to them.

This is why the Gare du Nord is a flashpoint. The area is generally tense but stable: everyone in the right place, from the police to the dealers. But when the police come in hard, it can feel like another display of colonial power. So the battle cry of "Na'al abouk la France!" is also a cry of hurt and rage. It expresses ancestral emotions of loss, shame and terror. This is what makes it such a powerful curse.

The rioters at the Gare du Nord or in the banlieues also often describe themselves as soldiers in a "long war' against France and Europe. The so-called "French intifada", the guerrilla war with police at the edges and in the heart of French cities, is only the latest and most dramatic form of engagement with the enemy.

In November 2005, 18 months before the riot in the Gare du Nord, the tensions in the banlieues had already spilled over into violence and, for one spectacular moment, threatened to bring down the French government. The catalyst was a series of confrontations between immigrant youth and the police in the Parisian banlieue of Clichy-sous-Bois. As the fighting between police and the banlieusards intensified, riots broke out in major cities across France. This was when the term "French intifada" was first widely used by the media and by the rioters themselves.

Rioters in the troubled banlieue of Aulnay-sous-Bois, November 2005. Photograph: EPA

The violence began on 27 October 2005, when two young men were electrocuted while trying to escape police by fleeing through an electricity substation. This incident was followed by almost a week of rioting every night, during which thousands of cars were burned. Then it began to spread to other French towns and cities. President Jacques Chirac declared a state of emergency, effective from midnight on 8 November. This gave the government and police special powers of arrest, the power to order a curfew and conduct house-to-house searches. But this only seemed to intensify the situation. On 11 November there was a blackout in part of Amiens when a power station was attacked – to the alarm of the police, this was to become a common and effective tactic. Churches were also firebombed.

The riots finally subsided after two weeks. But this was no easy victory for the police – quite the opposite in fact. The violence was partly fuelled by aggressive police tactics and by the belligerence of Nicolas Sarkozy, then Minister of the Interior, who declared "zero tolerance" and said that he would clean the streets of racaille (scum). Such inflammatory words only served to increase anger in the banlieues – it was clearly the language of war. By the end of November, with the French government in disarray, the riots across France had demonstrated that the youth of the banlieues could take on the authorities whenever they wanted to, and win. Since then the troubles in the banlieues have been sporadic but have never gone away.

The events of 2005 inevitably provoked an almost ceaseless flow of articles, books and debates in France. For all the noisy rhetoric, however, there were several important points of consensus on the right and the left. First of all it was generally agreed that the severity of the crisis had been exaggerated by the English-speaking media, who knew little of France and used the news of the French riots as a distraction from their own problems with immigration and immigrants in their own countries. This is, of course, the traditional role of the perfidious Anglo-American world in the French imagination.

Second, there was broad agreement that the riots had little or nothing to do with Islam or the historical French presence in parts of the Islamic world. Leftist intellectuals, in the pages of Le Monde or Libération, fell over themselves to distance the riots from any connection with the same anger that radicalised Islamists. According to these journalists, the riots were caused by a "fracture sociale" and lack of "justice sociale". Even the French intelligence services, the Renseignements Généraux, joined in, producing their own report, which described the riots as a "popular insurrection" and downplayed the role of Islamist groups and the immigrant origins of the rioters. In this way the riots of 2005 were domesticated and made part of a traditionally French form of protest. There was an almost complete denial that what was happening might be a new form of politics that was a direct challenge to the French state.

Gilles Kepel: 'Many French political commentators are blind. They do not understand that what happens here is because of our relationship with the Arab world, and our history there.' Photograph: Thomas Coex/AFP

There is, however, a very real conflict in contemporary France between the opposing principles of laïcité and communautarisme, which is being played out in the riots. The term laïcité is difficult to translate; put simply, it means that under French law it is illegal to distinguish individuals on the grounds of their religion. Unlike the Anglo-American model of the secular state, which seeks to hinder state interference in religious affairs, the French notion of laïcité actively blocks religious interference in affairs of state. This dates back to the revolution of 1789 and is traditionally understood to be a way of controlling and disciplining the Catholic Church. As a specifically anti-religious concept, laïcité, it is argued, guarantees the moral unity of the French nation – the République indivisible.

In recent years this core value of the French republic has been opposed by communautarisme, which sets the needs of the "community" against the needs of "society". Again, the loose Anglo-American model, where "difference" – whether of sexuality, religion or disability – is tolerated or even prized, does not apply in France, where "difference" is seen as a form of sectarianism and a threat to the republic. The most acute problem for the recent generations of Muslim immigrants to France is that the proclaimed universalism of republican values, and in particular laïcité, can very quickly resemble the "civilising mission" of colonialism. In other words, if Muslims want to be "French", they must learn to be citizens of the republic first and Muslims second; for many this is an impossible task, hence the anxieties over whether Muslims in France are musulmans de France or musulmans en France.

But this conflict is not just about politics or religion. It is also about extreme emotions. More than death, most human beings fear annihilation.This is a process familiar to psychiatrists who treat patients for disorders such as schizophrenia and depression. Part of the process of mental disintegration that characterises those illnesses is the experience of partial or total alienation. When a person loses all sense of authentic identity, all sense of self, to the extent that they don't feel that they properly exist, they then become literally strangers to themselves.

Historically this is what happened in France's territories during the colonial era and what is happening now in the banlieues. This is why it is almost impossible for immigrants to France from its former colonies to feel authentically "at home" there. For all their modernity, these urban spaces are designed almost like vast prison camps.The banlieue is the most literal representation of "otherness" – the otherness of exclusion, of the repressed, of the fearful and despised – all kept physically and culturally away from the mainstream of French "civilisation".

This is an argument made by the political scientist Gilles Kepel in his 2012 book Quatre-vingt-treize, a title that alludes to Victor Hugo's great novel of the Terror of 1793, and to the notorious Seine Saint-Denis district of Paris, which is known as "93" after its postcode. In his book Kepel conducts a forensic examination of the recent history of this district, concluding that although several varieties of Islam are at war with one another, they are all united in their hostility towards the secular French state.

Mohammed Bouazizi, the Tunisian vegetable seller who set himself on fire on 17 December 2010 and ignited the protests that led to the downfall of the government. Photograph: Reuters

Kepel is also convinced that one of the crucial conflicts in the banlieues is the challenge to the French republic from the "outside", by which he means both the banlieues and France's former territories in the Muslim world. Most importantly, unlike many of his peers, he sees the recent changes in French society as intimately connected to events in the Arab world which are little understood in the west. "Many French political commentators are blind," he told me in his cramped office just off the boulevard Saint-Germain. "They do not want to see the world beyond France. And so they do not understand that what happens here is because of our relationship with the Arab world, and our history there."

Kepel insists that the present tensions in France cannot be separated from the so-called "Arab spring" – the wave of rebellions that spread across the Muslim world in 2011. More specifically, the Arab spring has led to a severe shake-up of all accepted truths about North Africa, which until now has normally been known to the world through French eyes.

On 14 January 2011 President Zine Ben Ali finally fled his palaces in Tunis, heading for exile in Saudi Arabia. On the streets of Paris the mood that day was as festive as it was in cities across Tunisia. This was because the unthinkable had happened: Ben Ali had been in power since 1987 and seemed poised to stay in command for as long he liked – which, given his good health and vanity, could have been for a very long time – but, within a few short weeks, he was gone.

The catalyst for the angry demonstrations that led to his departure was the self-immolation of a 26-year-old street vendor called Mohammed Bouazizi in the obscure Tunisian town of Sidi Bouzid. At 8am on 17 December 2010 "Besboos", as he was known locally, set up his cart of fruit as usual in the centre of town. At around 10am he began to be harassed by police officers who claimed that he did not have a permit and had no right to be there. The reality was that Mohammed had simply not paid enough bribes and kickbacks to the local police, even though he had already put himself $200 in debt by borrowing money to pay off officials. But Mohammed was in a defiant mood that day and stood his ground when a middle-aged female officer insulted him, cursed his dead father, and tried to seize his cart. When the officer grabbed his weighing scales, his most expensive piece of equipment, without which he could not conduct any business, the young man broke down. Angry beyond belief, unable to control his weeping, he ran to the local governor's office to complain at this vicious injustice. The governor refused point blank to see him. In a torment of frustration, Mohammed stood outside the governor's and threw a can of petrol over himself. To the horror of the small crowd that was gathering around him, he then set the petrol alight. His body was ablaze as he staggered in circles in mute agony. This was at 11.30am, just an hour or so after the original row over his cart.

Mohammed died a few days later in hospital. His suicide has now gone down as the spark that lit the flame of the Tunisian revolution. As he lay dying, the ordinary people of Sidi Bouzid rose up against the petty bureaucrats who had held them in check until then. When the insurrection gained momentum, the military stopped trying to control the events and hundreds of thousands of Tunisians glimpsed that this was their first chance to oppose the authorities. Riots spread across the country and within a breathless few weeks, in the face of the hatred of his people, President Ben Ali was gone.

Tunisian protesters hold up a torn picture of ousted leader Zine al-Abidine Ben Ali. Photograph: Zohra Bensemra/Reuters

It was the fairytale nature of the revolution that was celebrated on the streets of Paris on the day of Ben Ali's departure. France has a Tunisian population of more than 700,000 people, mostly concentrated in the Parisian region. Everywhere you went in Paris during the revolt in Tunisia, portable televisions blared at top volume in shops, takeaways and cafes, broadcasting a polyglot, polyphonic babble from Al Jazeera, Al Arabiya and the French-speaking channels from the Maghreb. Everybody was excited and wanted to talk, especially the Tunisians themselves.

What was most stunning about these events – at least for those who did not know Tunisia – was that they had been set in motion in a country the west saw as a moderate, stable and apparently inconspicuous player in the politics of the region. Until this happened, the entire outside world thought of Tunisia as a downmarket tourist destination, with a servile attitude towards the west. All Tunisians knew that this view of their country was at best no more than wishful thinking and at worst a deliberate lie.

The bullying experienced by Bouazizi was the kind of thing that happened in Tunisia every day. It was directly connected to the people in power, who not only permitted but actively encouraged this low-level intimidation. When Bouazizi set himself on fire, his action spoke directly to a nation ready to stake all for freedom. The president's flight into exile was justice long overdue. "When Ben Ali left it was a beautiful moment," I was told by a young woman who had been out on the streets to protest against him in Tunis. "I did not know such happiness was possible."

In contrast to the jubilation of the Tunisian population in Paris that day, the mood of official France was sombre. The fall of Ben Ali was not at all what the French government wanted to happen. From the moment that he came into power in 1987, successive French governments had supported his regime, spurred on by his invoking Algeria and the threat of Islamist terrorism as a possibility in Tunisia. The French had taken Ben Ali at his word and turned a blind eye to all manner of abuses in the name of preserving "stability" in Tunisia. They had also believed his hold on the country was unassailable.

"We were taken by surprise," said Henri Guaino, special adviser to Nicolas Sarkozy with a particular brief for Mediterranean affairs. "Nobody saw what was happening. It all happened very fast, a chain of events that degenerated very quickly."

He also admitted, "I had not been vigilant enough about the development of the regime and Tunisian public opinion." That was putting it very mildly. Since the late 1980s, successive French governments had become mired in compromising and contradictory relationships with Tunisia. French diplomats had reported on the brutal nature of Ben Ali's regime as far back as 1990, but the authorities in Paris had looked the other way.

Most disgracefully, on 11 January 2011, Michèle Alliot-Marie, the French minister of state for justice, defence and home affairs, stood before the National Assembly in Paris and declared that the revolt in Tunisia was "a complex situation" and that it was not for the French government to "give any lessons to the regime". It was hard to imagine a more arrogant and self-serving statement, as the people of Tunisia were fighting for their freedom. But there was worse to come: Alliot-Marie went on to offer the French military's "world-renowned savoir-faire" to Ben Ali's regime, and to deliver this savoir-faire to Tunis. The response, across all parties, was open-mouthed incredulity. Was the French minister really suggesting that French soldiers or police would fire on crowds in Tunis?

Supporters of the Tunisian national football team whistle and hiss at the French national anthem before the match. October 14, 2008 at the Stade de France. Photograph: AFP/Getty Images

Sarkozy immediately distanced himself publicly from her – his adviser reported that Alliot-Marie had been giving her "own personal analysis of the situation". The left was slower to react, partly because many on the Left, including the mayor of Paris, had their own issues with Tunisia. In the regions and in the banlieues of France, however, the speech provoked anger. In Algeria the daily newspaper, Liberté, made the point that, in her arrogance, Michèle Alliot-Marie "has apparently no fear of awakening the memories of peoples who have already known historically the military savoir-faire of France". Tunisian bloggers – blogging was now the main form of communication in the country – were furious and sarcastic. "Merci La France!" was the response from a campaign on Facebook.

The controversy deepened even further over the next few days when it emerged that Alliot-Marie, who had close and friendly links with Ben Ali himself, had spent the Christmas of 2010 in a luxury resort in Tabarka, and had travelled there in a private jet belonging to an intimate friend of Ben Ali, who also happened to be a criminal. She had also recently bought an apartment in the holiday complex of Gammarth, just outside Tunis. Meanwhile Tunisia went up in flames.

Few Tunisians were surprised at this French duplicity. In the past few years they had seen Ben Ali and his family and friends become extremely rich by plundering the nation. Tunisia was not a wealthy Arab country – for one thing, it has no oil money. But this did not prevent Ben Ali and his associates looting the country's resources and spending the money in France.

French-Tunisian singer Laam was jeered when she sang the French national anthem before the start of the France v Tunisia football match, 14 October 2008, at the Stade de France in Saint-Denis, outside Paris. Photograph: AFP/Getty Images

When I arrived in Tunis in the autumn of 2012, I was practically the only westerner landing that afternoon. I could see straight away that everything had changed since my last visit in 2011. I had been a fairly frequent visitor to Tunis from 2005 onwards, but had not been back since the revolution. Now it was the same city but a very different place.

On the short drive into town from the airport, the suburbs looked dirtier and more broken than they had before. The most obvious change to the cityscape was the absence of the huge portraits of Ben Ali, which, until the revolution, had lined every main road in and around the city. As we headed into the city centre, there was graffiti everywhere, often in several languages, not just Arabic; the graffiti in English, French and Spanish called for more revolution, declaring war on the west and all those who hated Islam.

A few days earlier the US Embassy in Tunis had been attacked and the American School had been burned down by a Salafist mob, apparently demonstrating against the provocative anti-Muslim film The Innocence of Muslims. Only days before this, the American ambassador to Libya had been murdered by a jihadist militia. In Tunisia, the Americans had pulled out all their staff and citizens to let the Tunisians know that they were not to be messed with. The atmosphere was made even more brittle by the publication in France of images of the prophet in the satirical magazine Charlie Hebdo. As a consequence, the substantial French population of Tunisia had been frightened off the streets by death threats from the Salafists and stayed at home.

On my previous visits to Tunis, I had always thought that it was an easy place to work; it was safe and well organised. But despite its beauty and apparent order, there was always a secret and sinister side to Tunisian life. You were not exposed to the kind of violence and extremism that had so marked life in Algeria, nor was it as wretchedly poor as Morocco. Instead, Tunisia reminded me of my time in Romania in the early 1990s, where, even after the fall of Ceausescu, ordinary people were afraid to say what they really thought. Romanians described this as "auto-censure" – self-censorship – and said that it was far more effective than the Securitate, the secret police. Nearly everybody I met in Tunisia before the revolution had adopted these habits of mind. It was a place where you could not really connect with anyone. The secret police were ever-present, listening and watching. But they were not really needed in a country where no one dared to criticise the government anyway.

When the journalist Christopher Hitchens came here in 2007 to write a piece for Vanity Fair, he wrote that his friend Edward Said had described Tunisia to him as the "gentlest country in Africa". He was not disappointed by the stylishness of the Avenue Habib Bourguiba, the main artery in Tunis, the olive groves and the sheer gorgeousness of the island of Djerba (where 19 tourists were killed in an al-Qaida attack in 2002).

Hitchens found Tunisia to be a "mild" place and, although he expressed disquiet at the 20 years that Ben Ali had been in power, the ubiquity of his image and the general reluctance of people to discuss politics, he was comforted by the availability of contraception, young people holding hands, and other clearly visible signs of "western values" and indifference to the puritan values of Islamism. Hitchens was obviously writing in good faith and reporting what he saw. This is what everyone saw when they first came to Tunisia. Below the surface there was, however, a bitter version of Tunisian reality at work within the nation's psyche.

As in Algeria and Morocco, one of the few places you could glimpse the inner rage of the Tunisians was at football matches. In September 2008 I watched a crowd of no more than a hundred fans of Espérance Sportive Tunis – the major team of the country – take on the riot police in the backstreets around Place de Carthage and Place de Barcelone. What impressed me most was how skilled and organised the "hooligans" were – they were a quick-moving, agile force, constantly changing while remaining a solid phalanx. They smashed windows and roared through back alleys. They were completely in control of the situation and evidently enjoyed this battle with the foot soldiers of the regime. Later, in the Bar Celestina, a smoke-filled drinking den near the metro station, I spoke to a group of them. They were quick to make the point that they were not fighting other teams but only the police, which was the armed wing of the government. No one mentioned Ben Ali, but he was the obvious enemy.

So were the French. During the Ben Ali years, Tunisia was unofficially France's most favoured nation in the Maghreb. The links between Ben Ali and a succession of French presidents, from Mitterrand to Chirac and Sarkozy, were always firm and longstanding. Ben Ali travelled often to Paris, his "real capital", where he lived lavishly and courted not only the French political elite but also the more dubious figures of the Trabelsi clan. Ben Ali's second wife, Leila, was a member of the Trabelsi family, a Mafia-like organisation based in the most expensive quartiers of Paris and Nice, which effectively ran Tunisia as their private fiefdom. All Tunisians knew that the fall of Ben Ali was not only because of the ideological sterility of his government, but also because his large-scale pillaging of the country in collusion with the Trabelsis was about to be exposed. That is why he fled Tunisia so quickly.

The mutiny lasted no more than four weeks. But it changed everything in Tunisia and indeed across the Arab world, as ordinary people from Morocco to Yemen felt inspired and fearless enough to take on their rulers. Most Tunisians, not just the Salafists, now feel twice betrayed by France, the country that has dominated and shaped Tunisia's political and cultural identity for more than a century. Whether they wanted to or not, they grew up believing that France was their mother county, and that at the very least the French had the Tunisians' best interests at heart. During the heady days of the revolution, France was in fact revealed as a cynical and corrupt enemy.

On the evening of 14 October 2008, there was a friendly football match at the Stade de France between France and Tunisia. The French government had been anticipating trouble for months. Ever since the riots in Clichy-sous-Bois in 2005, all matches with North African teams had become potential triggers for trouble in Paris. Still,Tunisia was held to be a less volatile and dangerous place than either Morocco or Algeria and Tunisians in Paris are not seen as gangsters or Islamic radicals. But to defuse any possible tensions, the authorities had decided that the teams should mix together as they lined up and that the Marseillaise should be sung by Lââm, a young R&B singer of Franco-Tunisian extraction.

As soon as Lââm picked up the mic, the hissing started, rising quickly to a high-pitched crescendo of whistling which carried through the stadium like bad feedback. The singer looked around for help but none came. She fought on through the blizzard of white noise, but it was hopeless. When she finally stopped, Tunisian fans were laughing and high-fiving as if they were 3–0 up on the home team. "Where did it come from, this wall of hate?" I asked a Tunisian bloke next to me in the bar where I was watching the match. He smiled goofily and slugged back the remains of his beer: "Made in France!"

© Andrew Hussey

The French Intifada by Andrew Hussey, is published by Granta on 6 March, £25