Military intervention in an Arab country divides the British nation. Islamist revolutionaries declare jihad, gathering new recruits and conquering territory with astonishing speed. The West’s most powerful leader, a reluctant interventionist, becomes embroiled in a foreign conflict against his better judgement. An Islamic state is declared: its violence shocks the West, and a military coalition is created to destroy what is seen as a threat to civilisation.

If this summary of Victorian Britain’s engagement in the Sudan sounds familiar, it is not merely evidence of the cliché that history repeats itself. The military campaign against the Islamic state known as the Mahdiyah shaped the way people in Britain thought about religion, violence and statehood. That thinking was formed not only in diplomatic cables, parliamentary debates and despatches from the front, but also in celebrated poems and bestselling novels.

An image of Islamist violence was created by popular writers such as Rudyard Kipling and Arthur Conan Doyle, by the prolific and astonishingly successful GA Henty, whose publisher once estimated that 25 million copies of his books were circulating around the British empire, and by other, now forgotten writers such as DH Parry and George Manville Fenn. This stereotype was transmitted from generation to generation in further novels and stories and then in film and television. The Mahdiyah’s most enduring legacy is an archetype of the cruel, fearless and fanatical Islamic warrior that is as recognisable today as it was in the pages of Victorian fiction.

The events that led to the creation of this cultural nightmare began with Victorian Britain’s financial investment in Egypt. Because of its principal shareholdings in the Suez Canal, Britain could not ignore Egypt’s financial and political instability. War in 1882 led to an occupation that then embroiled Britain in Egypt’s huge and impoverished Sudanese possessions – at exactly the time when these were falling to an extraordinary revolutionary movement. In 1881, a religious student called Muhammad Ahmad proclaimed from an island in the Nile that God had revealed him to be the Mahdi (“the rightly guided one”): a figure from Islamic prophecy who, it is foretold, will rid the world of evil in preparation for the Day of Judgement.

The Mahdi’s subsequent revolt against the Sudan’s rulers in Cairo might have been little more than a historical footnote had the Egyptian and British governments managed events intelligently. But a succession of ill-prepared military expeditions against the Mahdi’s forces were checked by a combination of bravery and luck on the part of the defenders, and hubris and incompetence from the attackers, with the Mahdi’s reputation for divine favour growing with every victory. Swaths of the Sudan fell to the new state, which governed according to religious law, and which aimed to invade Egypt and, ultimately, the Ottoman empire.

In Britain, a popular campaign (spearheaded by the crusading journalist WT Stead and secretly supported by a cabal of interventionist generals) demanded that Charles Gordon, a former governor of the Sudan and – thanks to Stead and others – a military celebrity, be sent to crush the Mahdi and restore order. The prime minister, William Gladstone, despatched Gordon to Khartoum in 1884, but with orders to evacuate European garrisons, not to take on the Mahdi. Whether or not Gordon heeded his instructions, he swiftly found himself besieged by the Mahdists. Gladstone reluctantly authorised a relief expedition but Khartoum was overrun in January 1885 with the loss of an estimated 10,000 civilian lives. For the British press and public, however, there was only one death that mattered. Gordon became Victorian Britain’s greatest martyr.

The political fallout cost Gladstone his premiership but the consequences were deeper and longer lasting. The Victorians never forgot Gordon. They painted him, erected statues of him in cities from London to Melbourne, put him on mugs and bookmarks – but, more than anything, they mythologised him in newspapers, poems and novels. In 1892, Henty brought out The Dash for Khartoum: a Tale of the Nile Expedition, an adventure story set against the backdrop of the Gordon relief expedition, and in 1897 Henry Newbolt published one of the most patriotic poems of the age, “Vitaï Lampada”, drawing again on the expedition for its imagery of the “sand of the desert” that is “sodden red” with “the wreck of a square that broke”. In 1893, readers of the Strand Magazine discovered that Sherlock Holmes and Dr Watson had a portrait of Gordon on the wall of their Baker Street sitting room. It was only after Lytton Strachey’s Eminent Victorians was published in 1918, with its version of Gordon as an alcohol-fuelled mystical zealot, that the myth began to be debunked.

These myth-making cultural productions did more than commemorate a fallen hero: they ensured that the politicians and generals could not leave Gordon’s headless body in its Nile-side grave. Rudyard Kipling’s The Light That Failed (1891), written when Kipling was well on his way to becoming the most popular writer in the English language, takes on the Mahdiyah in its story of Dick Heldar, a war artist who goes blind after being wounded in the Sudan and who then fails to establish himself artistically and romantically in London. Fortunately for Heldar’s need for personal redemption, there is unfinished business in the Sudan, and he joins a military expedition to defeat the Mahdiyah. The expedition is a historical fact – but what is remarkable is that it was more than six years in the future when Kipling wrote the novel. This is important: it was because of writers such as Kipling that Britain had to return to the Sudan, which it did with a vengeance in the late 1890s under the leadership of Herbert Kitchener. Rallying his troops on the eve of the Battle of Atbara in 1898, Kitchener is said to have cried: “Remember Gordon!” His men, brought up on boys’ fiction and popular newspapers, would have needed no such encouragement.

The journalists, painters and novelists therefore created a political cause and, in doing so, they also created an enemy – one driven by religious fanaticism, which knew only cruelty and violence, and which, if left unchecked, would destroy civilisation. This stereotype was not unprecedented – Edward Said argued in Orientalism (1978) that centuries of European orientalist scholarship reduced Islam to a symbol of “terror, devastation, the demonic, hordes of hated barbarians” – but the Mahdiyah, rising as it did in an era of mass communication and rapidly expanding popular culture, was perceived as a threat not only by scholars and statesmen, but also by Britain’s growing and increasingly literate public.

The Mahdi and Abdallahi – the khalifa (“caliph” or “successor”) who took over after the Mahdi’s death in 1885 – called their troops the Ansar (meaning “followers”, a word rich in religious-historical associations and one that remains current among 21st-century jihadists). The elite warriors among the Ansar were called the jihadiyya. The Victorians, however, called them all “dervishes”, appropriating a term for the ascetic caste of Sufis, those following the mystical traditions of Islam. (That Sufis can be just as violent as Salafists is a point conveniently overlooked by those such as the historian Tom Holland, who attribute Islamist violence primarily to theological doctrine.)

The dervishes caught hold of the late-19th-century British imagination. With their uniform of patched coats called jibbas, they sprang, stabbed and shot their way across the pages of newspapers, novels and magazines. But Victorian writers, like Victorian generals, first had to make sense of why such an apparently primitive force was able to defeat modern, trained and well-equipped armies and to control such extensive territory. Arthur Conan Doyle encapsulated the answer in one of several stories he wrote about the Sudanese wars: “fearlessness and fanaticism”.

Occasionally, Victorian writers admired the dervishes’ bravery, as with Kipling’s tribute to the Hadendoa, a tribe allied to the Mahdiyah, in “Fuzzy-Wuzzy” (1892):

So ’ere’s to you, Fuzzy-Wuzzy, at your

’ome in the Soudan;



You’re a pore benighted ’eathen but a

first-class fightin’ man…

But the defining characteristic of the dervishes in the Victorian mind was their belief in martyrdom. As Conan Doyle put it in his novella The Tragedy of the Korosko (1897), in which the dervishes kidnap a group of Western tourists, some of whom are brutally murdered while others are threatened with rape or forced conversion:

Here were to be read the strength and danger of the Mahdi movement; here in these convulsed faces, in that fringe of waving arms, in these frantic, red-hot souls, who asked nothing better than bloody death, if their own hands might be bloody when they met it.

While British bravery, religiosity and self-sacrifice are revered – as in the story of Gordon’s martyrdom – the same qualities are attributed to a dark and primeval ideology when found among the dervishes, who are insistently presented as the barbaric vestiges of a pre-civilised age.

More troubling, perhaps, is the shadow of what today would be called Islamophobia, as the Victorians struggled to understand how the Mahdiyah’s appeal could cross tribal and ethnic frontiers. The dervish leader in The Tragedy of the Korosko is “a red-hot Muslim of the old fighting, preaching dispensation, who never hesitated to carry the fierce doctrines of the Koran to their final conclusions”, while the same author’s short story The Green Flag depicts “two races” among the Mahdi’s followers, “as wide as the poles apart, the thin-lipped, straight-haired Arab, and the thick-lipped, curly Negro; yet the faith of Islam had bound them closer than a blood tie”.

Underlying these stories is an anxiety of empire: as Gregory Hilliard Hartley, the boy-hero of Henty’s With Kitchener in the Soudan: a Story of Atbara and Omdurman (1903) points out, Victoria “reigns in India over many more Mohamedans than are ruled by the Sultan of Turkey”. This explains why the polite, intelligent Gregory accepts that enormous bloodshed will be required to destroy the Mahdiyah:

When he remembered the wholesale slaughter at Metemmeh, the annihilation of countless villages and of their inhabitants, and, above all, the absolute destruction of the armies of Hicks Pasha, the capture of Khartoum, the murder of Gordon, and the reduction to a state of slavery of all the peaceful tribes of the Soudan, he could not but feel that the annihilation of these human tigers and the wiping out of their false creed was a necessity.

The present-day resonances of the dervishes go beyond their conduct in battle. The Mahdiyah alarmed the Victorians in part because it was governed according to principles that were alien to 19th-century global realpolitik. In another of Conan Doyle’s short stories, the Mahdiyah is “a land of blood and horror” whose only export is mutilated refugees and where “dark mountains” rise from “that sinister reek like islands in a sea of blood”. Here, the Sudan is located beyond the outposts of civilisation.

More recent historians, relieved of the ideological baggage of Henty and Doyle, have documented the Mahdiyah’s achievements, such as its sophisticated bureaucracy and its capacity for negotiation, as well as its genesis in Egypt’s grotesque exploitation of the Sudan in the decades leading up to the Mahdi’s revolt. But most Victorians saw only religiously motivated violence, meted out to the Mahdiyah’s citizens as well as to its enemies.

In the 1890s, after several Westerners imprisoned in Khartoum were able to escape with the assistance of Kitchener’s intelligence chief, Reginald Wingate, first-hand accounts of life under the khalifa’s rule became available. These were written, translated and published under Wingate’s supervision, with a deliberate propagandising aim as the British and Egyptian armies prepared to invade the Sudan. Time and again these accounts emphasise the brutality of the Mahdiyah’s legal system: hangings, decapitations and amputations are described in shocking detail and depicted in lurid half-tone illustrations.

Wingate’s intention was to legitimise the Anglo-Egyptian military campaign, and this succeeded beyond what he could have hoped as populist writers turned factual accounts into gripping narratives. Conan Doyle, who witnessed preparations for the invasion as a correspondent for the Westminster Gazette and wrote admiring accounts of Kitchener and Wingate, drew deeply on those contemporary accounts for The Tragedy of the Korosko, which was serialised in the Strand Magazine in 1897. Indeed, the Sudan campaign was a milestone in Conan Doyle’s career as a self-appointed government propagandist: he went on to defend the Second Anglo-Boer War against international and domestic criticism so vigorously that he was awarded a knighthood. There were a few dissenters, such as Hilaire Belloc, who greeted the news of the slaughter of the Ansar at the Battle of Omdurman with his ironic ditty in The Modern Traveller (1898): “Whatever happens, we have got/The Maxim gun, and they have not.”

Our most lasting cultural memory of the Mahdiyah’s Islamic state, however, is AEW Mason’s The Four Feathers, published in 1902. By this time, the conquest of the Sudan was complete, so there was no need to explain or justify a campaign. Mason’s purpose was, rather, to examine and commend the virtues of courage and loyalty in social and martial settings. But his novel does so against a backdrop of an alien inversion of those virtues, and its most memorable sections are set not in the ballrooms of aristocratic England or the field tents of the British army, but in Umm Hagar – the “House of Stone” in the khalifa’s capital of Omdurman – where the heroes Colonel Trench and Harry Faversham endure years and months, respectively, of the most hideous punishment:

Already it was occupied by some thirty captives, lying upon the swamped mud floor or supported against the wall in the last extremities of weakness and disease. Two hundred more were driven in at night and penned there till morning. The room was perhaps thirty feet square, of which four feet were occupied by a solid pillar supporting the roof. There was no window in the building; a few small apertures near the roof made a pretence of giving air, and into this foul and pestilent hovel the prisoners were packed, screaming and fighting. The door was closed upon them, utter darkness replaced the twilight, so that a man could not distinguish even the outlines of the heads of the neighbours who wedged him in.

For all this novel’s technical sophistication, it is at bottom as ideologically purposeful as Henty’s and Conan Doyle’s stories about the dervishes: civilised virtues must prevail over barbaric creeds.

The Four Feathers also illustrates the longevity of these cultural stereotypes. Henty, once Britain’s most popular writer of fiction for boys, is now largely forgotten, but Mason’s novel was commercially successful and was the source for half a dozen cinematic adaptations, notably the Korda brothers’ 1939 version, which, on the eve of the Second World War, presented the khalifa (played by John Laurie) as a cackling villain leading a ruthless martial state. The epic sweep of The Four Feathers also inspired Basil Dearden’s Khartoum (1966), in which Laurence Olivier, in blackface and with a prosthetic nose, rolls his eyes as a charismatic but pantomimic Mahdi.

The after-images of these adaptations can be glimpsed in any number of films and television dramas that imagine holy warriors of Africa and the Middle East as primitive but terrifying fanatics, motivated by a creed we can barely understand, inexplicably powerful, a threat not just to the lands they inhabit but to global order and our way of life.

It would be absurd to suggest that our understanding of today’s security challenges is merely the product of a tradition of populist orientalism. Through its propaganda channels, Islamic State presents itself as ultra-violent and beyond political norms. Yet its dominance of headlines and its intrusion into the minds of people far removed from its Middle Eastern heartland, even before it began to attack European cities, demonstrate the persistence of our cultural nightmares and how readily they can be revived. As we in the West seek to understand what lies beyond our direct knowledge, we inevitably draw upon our imaginations, which are shaped by representations from fiction as much as by the presentation of facts. More than a century after its military defeat, the Mahdiyah lives on in our minds.

Andrew Glazzard is a senior research fellow at the Royal United Services Institute and the author of “Conrad’s Popular Fictions” (Palgrave Macmillan)