The imam of the Drancy mosque in Paris leaves flowers and prays near the Charlie Hebdo offices. Photograph: Marc Piasecki/Getty Images

Those of us trying to make sense of the Charlie Hebdo massacre need to understand the bloody history of my home city, Paris. That four hugely popular cartoonists were considered legitimate targets by murderers said to have been living within a few miles of the Louvre and other global symbols of liberal Gallic civilisation doesn’t seem possible: donnish satirists are not meant to be gunned down in quaint Paris arrondissements any more than municipal policemen used to dealing with traffic and tourists.

Sadly, the French capital has been associated with some of the worst barbarism in human history.

The Terror started by the 1789 Revolution led to tens of thousands of deaths, with many of its victims guillotined in front of vengeful crowds. Savage mass murders continued on squares and boulevards throughout the 19th and 20th centuries, through the Commune and two world wars, the second of which saw tens of thousands of Jews persecuted before being sent to their deaths in concentration camps. Postwar, many of the Gestapo-trained gendarmes involved in the those atrocities showed a fresh brutality to Algerians displaced by their own nation’s fight for independence from France.

The three French-Algerian men believed responsible for the 12 deaths in Paris on Wednesday would have been steeped in a recent history of this conflict which, in the 1960s, was exported from the battlefields of Algeria to Paris itself. During one notorious atrocity in 1961, up to 200 Algerians were slaughtered around national monuments, including the Eiffel Tower and Notre Dame cathedral. Many were tossed into the Seine from some of the most beautiful bridges in the world and left to drown.

Half a century on, the violence has subsided but there is still a strong sense of resentment among alienated communities living in housing estates on the outskirts of the capital. Many are Muslims of north African origin who complain that discrimination against them extends to every field of life, from housing and employment to the right to religious expression. This is particularly so as politicians of the left and right regularly blame Islam for these social problems, which in fact have nothing to do with spiritual faith.

Anti-religious hate speech has thus become all too prevalent in modern France, as it is manipulated for political purposes. Jean-Marie Le Pen, the founder of the National Front, is a convicted racist and antisemite, and his daughter, Marine Le Pen, the party’s current leader, regularly stigmatises Muslims and other minority groups.

Immigration policy underpins all of this discourse. Manuel Valls, the reactionary Socialist prime minister, infamously portrayed Roma gypsies as a group who cannot integrate and who should be deported back to Romania and Bulgaria, despite being EU citizens. This was followed by a number of violent attacks on Roma, while a right-wing mayor blocked the burial of a Roma baby in a municipal cemetery last week.

There is no doubt that Charlie Hebdo’s notorious cartoons satirising the prophet Muhammad saddened and angered Muslims in equal measure. When the magazine published a cover with a bearded and turbaned cartoon figure of the prophet saying “100 lashes if you’re not dying of laughter” in 2011, their offices were firebombed.

Other images and articles were also vindictive, including some about the other major monotheistic religions, Christianity and Judaism, but it was Islam that the Hebdo team always really had in its sights. Its murdered editor, Stéphane Charbonnier, regularly expressed his disdain for this religion. Such prejudice was in fact condemned by the White House in September 2012, when a spokesman for President Obama questioned the judgment of Charlie Hebdo for publishing “images that will be deeply offensive to many and have the potential to be inflammatory”. Richard Prasquier, head of France’s Jewish council, also said he disapproved of the caricatures because they constituted a “form of irresponsible panache”.

The climate of intolerance across France may well have been something Charlie Hebdo was reflecting, rather than creating, but strict laws banning hate literature would certainly have made many of its past issues unpublishable in countries including the UK. Comparisons between Private Eye, the British satirical weekly, and Charlie Hebdo have been made recently, but actually they are wrong: the self-styled “nasty” French magazine produces a far darker form of satire.

The sacred point, however, is that none of this in any way justifies violence, let alone the horrific slaughter this week. The vast majority of French Algerians and, indeed, Muslims across the world, were shocked and appalled by the murders, with a spokesman for the French Council of the Muslim Faith speaking of a “barbaric act against humanity, democracy and freedom of the press”.

Hassen Chalghoumi, imam of the mosque in Drancy – scene of those Holocaust deportations during the Nazi occupation – spoke up for many when he said of the killers: “They have sold their souls to hell. This is not freedom. This is not Islam and I hope the French will come out united at the end of this.”

Two of the dead – Ahmed Merabet, a police officer, and Mustapha Ourad, who was working in the Charlie Hebdo office – were themselves Muslim. Many fellow Muslims were among the crowds that poured on to the streets on Wednesday night in a show of solidarity for the Charlie Hebdo victims, rallying behind President Hollande’s call for national unity.

Despite all this, the seemingly inevitable backlash has begun, with mosques being targeted. Blank grenades were thrown at one in Le Mans on Wednesday night, with bullet holes also found in its windows. Shots were fired at a Muslim prayer hall near Narbonne, in the south of France, while an explosion close to a mosque in Villefranche-sur-Saône was described by a local prosecutor as a “criminal act”.

As the history of Paris shows, extreme violence often inspires further violence. The bloody cycle continues, just as it has always done. But attributing its causes to millions of law-abiding French Muslims is as cynical as trying to blame it on a small group of artists and writers.