DURING the final stages of writing my new novel, A Woman Scorned, I was tucked away in Bishop Auckland Library, pounding away at my laptop, writing very fast as always happens at the end of a novel. I was engrossed in a village in 19th century Durham, smelling its smells, hearing its voices.

After a while I was aware of a person standing behind my right shoulder, staring at me.

This sometimes happens in the library. People are curious about what I'm doing. I moved my head, but the person stayed. I could still feel the stare. I finally turned to smile and comment - this usually sends them away - but there was no one there.

It was spooky but not threatening. I felt a warmth, a sense of approval.

Writing fiction of any kind is like raising ghosts. But these ghosts are usually invented, spawned in the soup of very functional and practiced imaginations. The creative process involves knowing and bathing yourself in the materials of your inspiration until you can feel your characters with you, can hear their voices in your ear.

A Woman Scorned is different. All except two main characters are real. They already existed on the record in 1870s Durham. Victoria Kilburn, who was a purely invented character, did speak in my ear and live and breathe for me in the writing of this novel. But then so did Marian Cotton, Doctor Kilburn, and Mr Riley and many others who in 1870 were flesh and blood.

We all love monsters. They convince us that - sinners as we are - we are normal and wholesome and in control of our lower instincts. The particular monster of my part of Durham was - and is - Mary Ann Cotton

Mary Ann Cotton,

she's dead and she's rotten...

As a child, like many round here, I skipped to this rhyme about our own particular monster, chanting with relish how she received her just desserts dangling at the end of a rope in Durham Gaol.

But it was only recently that I succumbed to the long temptation of basing a novel on this infamous and intriguing case with the ambiguous, shadowy figure of Mary Ann at its centre. Like any historical novelist I started with an idea, and a whole assembly of sources. The idea was to explore the inside of this case not just with my intellect, but with my imagination.

Of course, to feed that imagination the research had to be done. The most careful, reliable and well- researched source is the late Arthur Appleton's Mary Ann Cotton. All other published sources depend heavily on his work. Then there are contemporary newspaper reports of the case, where verbatim accounts of the court procedures are so very vivid that vernacular speech comes over. I became a spurious expert in poisons and Victorian poisoning cases, in the legal system in the 1870s. And I looked at pictures, images and maps, explored old back streets on foot - dry as dust material to some but lifeblood to pedants like me.

But as a novelist - a creator of fictional worlds - one has to be very careful about the heavy loading of facts. They are often too powerful and solid to stand as the warp and weft of a good novel, which should have its own dynamic truth, its own lightness of being.

At this point I turned to a photograph: the famous and much-publicised image of Mary Ann Cotton. There she is in her black Old Mother Riley bonnet, her infamous black and white shawl: the picture of guilt.

I started to play about with the image, blowing it up many times on the photocopier, until it was very large. Then I cut away the bonnet and the shawl and was left with just the face. I noticed now how thick and strong the hair was, how large and sad the eyes. This reminded me of the newspaper account where the reporter comments how in court Mrs Cotton seemed surprisingly delicate and demure, unlike the monster portrayed in the press and the pamphlets for many months before the trial.

My cut-away image showed a good looking, quite sensitive woman of 40, who looked younger. Up to that point she was a survivor, in a time when working class women looked old before their time.

At last I was seeing her as a human being, not some symbolic bogeywoman. Now I could raise her in my imagination and make her a character in my novel, allow her to come to my own sense of the truth of her experience.

My final creative act was to alter her name. I could hardly bring her to life with the dreadful droning skipping rhyme banging on in my head. I would call her Marian and imagine her story my way.

Then I turned inwards and looked at my own attitude. In the past, even as I began work on this novel, I had - like all of us - assumed her guilt. Wasn't the crime too large, too heinous for the judgement to be wrong? Surely it must be!

But now the new, more complex image of Marian began to emerge through the welter of fact, allusion, speculation and assumption. As I revisited the material I became outraged at the inappropriate procedures, unjust processes that were visited on this woman. She was never properly represented. The judge at the Durham Assizes suspended the trial while they scrambled round to find her a barrister to defend her against one of Britain's leading barristers, who later became an MP and Attorney General in Gladstone's ministries. Crucial forensic material was dug up again from a doctor's garden where he had buried it after a previous autopsy. And then treated as clean evidence.

And so on.

Of course, all this could have been expressed in an outraged pamphlet and added to the Mary Ann Cotton archive as another bit of the localised argument on this case.

But as a novelist I am interested in the 'what?' of history but also in the 'why?' and the 'how?' My mind was already bubbling with parallels of witch-hunts and social scape-goating. I concluded that an imaginative exploration of Marian Cotton's life in a 19th century Durham village might bring out some deeper human truths - not just about the 1870s but about life and attitudes today; not just about life here amongst us in Durham, but life in the wider world.

The only way I found to approach this task this was to balance the powerful, historical Marian with an important, central character drawn purely from my own imagination. Victoria Kilburn with her innocent, objective eye comes to visit her uncle in the village and allows us to view more clearly the dramas of Marian's life and death. Through Victoria the novel becomes an independent imaginative entity, not just a fictional rendering of an episode of history.

Even so, the novel doesn't depart from the known truth. All the facts of the prosecution and conviction of Marian Cotton are as on the historical record. But my hope is that the novel, with Victoria as well as Marian Cotton at its centre, will add some true emotional and imaginative insights into the case of this ambiguous, fascinating woman and the injustices visited on her. If in doing so, I collude in demolishing a monster, all well and good.

I am just wondering though, if the presence I felt in Bishop Auckland library was Marian or Victoria. Could be either, when you think of it.