English National Opera programme book, October 2009

'A new witness suddenly came forward, the gate-keeper's little daughter, Rosie. She and a small friend had been "playing Bluebeard" at the railway gates on Thursday. She had been sister Anne in her tower and had called out to her companion when she saw anyone coming along the road.' This turns out to be a useful encounter for Lord Peter Wimsey as he sleuths his way about the pages of Have his Carcase, and shows that Dorothy Sayers was a shrewd observer of the relish with which some children re-enact bloodthirsty and thoroughly frightening stories.

And Bluebeard can hardly be called a fairy story. It is violent and gruesome and, as pointed out by Bruno Bettelheim in his study, The Uses of Enchantment, has almost no element of the magical or supernatural. Specifically, in all its many different manifestations, it is about darkness and light - the darkness of fear and ignorance, the light of knowledge and clarity, the contrast between being shut in or released, imprisoned or free.

Béla Balázs based the libretto that he wrote for Bartók on the story by Charles Perrault, first published in 1697. It is one of many myths or tales featuring a monstrous husband who forbids his wife to enter a certain room, to use a certain key, to unlock a certain box. Sometimes the inference is that the ban is harsh and unreasonable, sometimes that the curiosity of the wife is deplorable and worthy of punishment. In one of the earliest versions of the story, Pandora opens the box with which she has been entrusted by Zeus (chief of the gods but hardly the most trustworthy) and releases fear and spite, penury and misery, into a world hitherto unfamiliar with such things. Mercifully, the one thing that remains at the bottom of the box is hope.

Perrault's version roots the events in a very contemporary 17th-century setting. Bluebeard has a gilded coach, his castle is hung with tapestries and richly furnished, his cupboards and wardrobes groan with gold and silver plate, caskets of jewels and sumptuous velvet and silk garments; his wife's brothers, who eventually ride to her rescue, are respectively a musketeer and a dragoon. This element of realism possibly accounts for the many attempts to give the story an historical foundation. The source of the Bluebeard character has frequently been supposed to be Gilles de Rais, a Breton nobleman born in c. 1404, a Marshal of France who fought for Joan of Arc and was ultimately excommunicated and executed for crimes that were said to include the kidnapping and murder of numerous women and children. Endless rumours and accusations are twisted around the accounts of his life but one thing he certainly did not in fact possess was a blue beard. As Thomas Wilson says in his biography of 1899: 'His hair was long and black and his beard the same. It was soft and silky, and with its raven blackness became shiny, giving it a tinge of blue-black, which may have served as foundation for his pseudonym of Bluebeard'.

What Charles Perrault depicts very clearly is the loveless and mercenary nature of the marital arrangement between Bluebeard and his wife. There are two sisters, both of whom are repelled by their suitor (he is happy to accept either of them) because of his ugly beard and the fact that he is known to have had several previous wives. In order to win them round, Bluebeard invites them and their mother to stay with him, entertaining them so lavishly that they overcome their reluctance and the younger sister agrees to marry him. A month after the marriage is concluded, Bluebeard has to go away on business and leaves his wife with the keys to every door in the castle but forbids her to open the door of one small room. He gives no reason for this. As soon as he is gone, the (nameless) wife invites her sister, mother and all their friends to visit. They run riot, swathing themselves in silks and satins, dangling jewels about their necks, admiring their reflections in the glittering mirrors hanging from the walls. The wife, beside herself with curiosity, abandons her guests, runs headlong down a flight of stairs (so fast that she nearly falls and breaks her neck) to the forbidden room and unlocks it. Inside she finds the murdered bodies of her husband's previous wives, drops the key in horror, tremblingly locks the door again but finds that the key is now indelibly stained with blood. Her frantic efforts to scrub it clean are in vain and her husband returns to find this evidence of her disobedience. He tells her that he she must die. Mother and friends have all disappeared but her sister Anne has remained and climbs a tower in the castle to look out for signs of rescue. The wife stalls for as long as she can but Bluebeard is remorseless. He draws his sword and is about to execute her when her two brothers burst through the castle gates and kill him. As a result she is left as sole heir to his estate, bestows enough money on Anne for her to marry the man she loves, buys commissions for her two brothers and marries herself to 'a worthy gentleman who made her forget the ill time she had passed with Bluebeard'.

There is something very brisk, bourgeois and Gallic about this telling of the tale. Subsequent retellings have spun, skewed and subverted it every whichway. The Brothers Grimm inject an element of humour and ingenuity with Fitcher's Bird, in which two sisters are kidnapped and horribly dismembered by a disguised sorcerer. The third sister not only pieces her sisters back together again but manages to get the sorcerer to carry them home concealed in a basket, disguising herself by covering herself in honey, slitting open a mattress and rolling in feathers until she is unrecognisable. Anatole France in The Seven Wives of Bluebeard (1920) writes from a perspective which makes Bluebeard a bamboozled innocent who suffers repeated indignities at the hands of a series of malicious and avaricious wives. Eugène Sue came up with The Female Bluebeard (1842), who is suspected of indulging a string of lovers and husbands before murdering them but turns out to be faithfully married to King Charles II's illegitimate son the Duke of Monmouth, thought to be dead but in fact alive and well and busily adopting a series of disguises which give the impression of a male harem. Kurt Vonnegut's Bluebeard (1987) is Rado Karabekian, a painter who comes across a woman, Circe Berman, invites her for a drink and finds her taking over his life. She explores his house, redecorates part of it without permission but is frustrated by his refusal to let her into the locked, windowless potato barn. Charles Dickens created the hideous Captain Murderer (or remembered his nurse telling terrifying tales about him), who forces his wives to make pastry and roll out a pie-crust before chopping them up, peppering and salting them, baking them and crunching up every last bite.

With exquisitely tainted sensuality, Angela Carter wrote her version of the Bluebeard story in her 1979 collection, The Bloody Chamber. It comes very close in atmosphere to the symbolist imagery of Balázs' libretto. There are three major elements for Balázs: dark, light and blood. The text is saturated with all three. He pares the action down to a confrontation between Bluebeard and Judith, who has willingly left her intended bridegroom and her family to come to him. For Balázs, the castle is almost a third character; it is Bluebeard's soul. As he wrote in 1915: 'Into this castle, into his own soul, Bluebeard admits his beloved. And the castle (the stage) shudders, sighs and bleeds. When the woman walks into it, she walks into a living being.'

Angela Carter dates her tale in the age of symbolism. Her Bluebeard collects paintings by Moreau and pornographic drawings by Félicien Rops; a calf-bound volume of Huysmans' Là-bas lies open in his library; his painfully young wife plays 'the deliquescent harmonies' of Debussy on the piano. Fastidiously undressed by him on their wedding night as if he 'were stripping the leaves off an artichoke' she is left shivering, like a peeled fruit, 'naked but for her button boots'. He, with his lips and tongue made more explicitly wet and red, more unnervingly like the female sex, by being revealed in a thicket of wolfish dark hair, is a sensualist who enjoys a post-coital supper of 'pheasant with hazelnuts and chocolate, white voluptuous cheese and sorbet of muscat grapes'.

Each writer enters this dark world in his or her own way, devising new variations and discovering new insights. Unfortunately there are viler, more imponderably damaged and twisted Bluebeards to contend with outside the pages of fiction. Men who lock women away from the world; raping, abusing and torturing them. Josef Fritzl imprisoned his own daughter in the basement of his house in Amstetten in Austria, and fathered seven children by her. She was 42 years old when his crimes were eventually discovered. Jaycee Lee Dugard was found in August 2009, having been abducted by Philip Garrido in 1991, when she was eleven. She had two daughters while she was imprisoned by Garrido but always referred to herself as his daughter and described the children as her younger sisters. Dr Heidi Kastner, the forensic psychiatrist who ruled that Fritzl was sane enough to undergo trial, talked of his desire to exert total power over another person, his overwhelming need to see the fear in his victim's eyes, to keep her completely for himself. It is perhaps this distorted craving for ownership and mastery that lies at the black heart of all these tales.