WITH her high pitched cackle, the witch of our collective imagination has a pointed hat, hooked nose and rides a broomstick....a stereotype of the fairy tale baddie.

In fiction, too, Scottish witchcraft holds a unique fascination. From the whirling dervish Cutty Sark (a nickname given to the witch Nannie Dee seen by Tam O'Shanter in Robert Burn's Alloway graveyard poem) to the coven of three sisters in Shakespeare's Macbeth, these witches are as intoxicating as the fumes from a bubbling cauldron.

But while today's Pagans might see the witch as a healer in touch with nature's powers, there is a far darker side to the story. Between the mid-16th and early-18th centuries Scotland tortured and brutally killed thousands of ordinary women accused of witchcraft, creating a devastating climate of suspicion and fear that to this day goes largely unacknowledged by memorials or official epitaphs.

According to Dr Julian Goodare of Edinburgh University's history department, who set up the Survey of Scottish Witchcraft and has studied Scottish witch hunts for decades, the idea that witches were women who had sold their souls to the devil first began to take hold in Europe in the 1430s and gradually spread. The Scottish Witchcraft Act was passed in 1563, making both the practice of witchcraft and consulting with witches capital offences.

The women identified as witches and hauled in for questioning were not, as was once thought, those who identified as Pagans, he says. "Modern witches identify as Pagans or Wiccans and so forth but this was not the case in early modern times. In pre-Christian times groups might be described as Pagans, there are connections between the Celts and Druid traditions for example.

"But people in Scotland at the time of the witch hunts would identify as Christians. They might, of course, be involved with rituals that the church might not approve of."

Some he said, would have referred to themselves as "charmers" and offered services like fortune telling or spells, rituals or prayers (known as charms).

"There were undoubtedly early modern Scottish women who were healers," says Goodare. They may have offered help for those who were sick, love potions for those abandoned by their sweethearts or even information about lost or stolen property. Others were accused on the basis of paranoia about political conspiracy while later women were strangled and burnt at the stake as a result of petty neighbourhood disputes.

The first mass trials of the North Berwick witches of 1590 were those accused by King James VI of summoning stormy seas that stopped him from bringing his 14-year-old bride, Anne of Denmark, to Scotland. His suspicion first fell on Geillis Duncan, a local maid seen practicing healing, but soon tens of women – and some men – from across East Lothian and Edinburgh were implicated including Agnes Sampson, Agnes Thompson, Robert Grierson and Barbara Napier, who confessed to witchcraft under torture. The trials ran for two years and implicated 70 people in total.

"These are real people and they are burnt at the stake," says Goodare. While most were strangled first, some were burnt alive.

"It's a particularly brutal punishment, even for the time," he adds. "It's estimated that in Scotland about 2,500 were executed for witchcraft. It also created a climate of real fear. In Scotland the extent of our witch hunts were about five times the European average."

While some men were indeed put through the same ordeal, the overwhelming majority – 84 per cent of an estimated 3,837 people accused of witchcraft in Scotland – were women. Professor Liv Helene Willumsen, of Norway's University of Tromsø, another expert in Scottish witches, says: "Women in Scotland are targeted during the witchcraft trials in Scotland. The prevailing ideas [are] that women are weak, disposed for evil deeds and easily tempted by the devil to enter into a pact with him.

"The connection between a woman and the devil – not a man and the devil – is seen all over Europe."

Most were tortured to make often outlandish confessions. Sleep deprivation, sometimes secured by the help of a "witches bridle" – an iron instrument with four sharp prongs forced into the mouth" – was the most popular, which could lead to wild hallucinations.

Trials continued, in intense bursts, right up until after the Revolution of 1689 when a now more secular state lost its need to "prove its godliness" by executing witches. The Scottish Witchcraft Act was repealed in 1736.

Goodare says: "What we can learn from looking at this period is what happens when we adopt a totalitarian, black and white view of the world." The results are brutal.

Charmers, curers, conspiracy and confession

Researchers poring over trial transcripts have noticed a similar pattern. After many days of torture most women confessed to selling their soul to the Devil as charged. But other offer a different explanation. Here are some that stood out.

Janet Boyman

Tried and executed in1572, she was one of the first women to be accused of witchcraft due to political conspiracy. Mary Queen of Scots had been imprisoned in Loch Leven Castle several years before and those looking to free her planned to summon forth the spirit of Obirion, a demon or fallen angel, to help them in their cause. They employed Boyman to use her powers as a healer and charmer to tell them if they would survive this attempt.

In her accounts it's the fairies – who she refers to as "the good neighbours" – on whom her powers depend. On trips to Arthur's seat after dark she claims to have had many strange encounters including one with the Queen of the Fairies.

Agnes Sampson

One of the women accused as part of the Berwick trials, Sampson was a midwife and "charmer" who also offered fortune telling. Accounts recall that she would say a prayer over someone to determine if they would live or die. If she halted twice while reciting the news was not good. She was imprisoned in the Tolbooth of Haddington, brought to Edinburgh and interrogated by the King James VI himself. After being tortured she confessed to things "most magical and strange" and admitted 53 counts against her. In 1591 she was garotted and burnt at the stake.

Isobel Gowdie

The confessions of Isobel Gowdie – which inspired a symphony by Scottish composer Sir James MacMillan – are strikingly lurid. Gowdie, from Auldearn near Nairn, confessed to witchcraft in 1662, without the brutal torture which was standard, but was executed all the same. Over a six-week period of questioning she claimed to be a member of a coven in the service of the Devil, with whom she had sex, raised an unchristened child and used it to make a potion and said she met with the fairy queen and king. The detailed descriptions of covens of 13 are the basis of many now discredited myths about witches that still circulate today. It is thought she may have suffered from ergotism, the effect of long-term ergot [a fungus from cereals] poisoning

Scotland's last "witch"

As a child Margaret Hahn didn't understand what had happened to her grandmother, Helen Duncan, in 1944, then living in England. "All I knew was that it caused my family a lot of hurt," she said. When she was 12 her mother, Duncan's third eldest of six, came across an article and Hahn discovered her grandmother – a psychic and medium – was the last Scottish woman (and one of the last in the UK) to be prosecuted under the un-repealed English Witchcraft Act 1735.

Duncan, born in Callender in 1897 is said to have a "unique gift" from an early age that saw her able to emit ectoplasm from her mouth during trances that formed into spirits. She made her living by conducting séances and was living in Portsmouth, the home of the Royal Navy in 1941, when the spirit of a sailor reportedly appeared at one of her seancés announcing that he had just gone down on a vessel called the Barham. The news was supposed to be a high-security secret with the loss of HMS Barham not officially declared until several months later.

Due to her "vision" she was arrested in 1944 and tried by jury at the Old Bailey for contravening Section 4 of the Witchcraft Act of 1735. She was found guilty of purporting to be a witch and served nine months in prison. Her family, who insist she was wrongly convicted under outdated legislation, are seeking a pardon and for her files to be made public.

"I believe that the government could have dealt with my grandmother in a more humane way," says Hahn. "It continues to be a travesty of justice in my eyes." Although a pardon could only come from the UK Government co-ordinator Graham Hewitt is now writing to Nicola Sturgeon for support. He said: "We have been stonewalled by the Home Office and central Government. They tell us this is not in the public interest. The point is that she was prosecuted on an outmoded piece of legislation. Neither was she properly defended. Her lawyer was inept, incompetent and a menace."