‘Their limbs wracked and, tormented so ... their arms, necks, and backs turned this way and that way, and returned back again. Their mouths stopped, their throats choked. They had several sore fits.’ – A contemporary description of cousins Betty Parris and Abigail Williams, the first of the afflicted at Salem.

Their speech was garbled and their limbs contorted, they wailed and howled and convulsed. It was 1692. Betty was nine and Abigail was 11.

Reverend Samuel Parris was advised by a doctor that the girls, his daughter and niece, respectively, were bewitched. Soon, at least five other girls in Salem Village developed similar symptoms and began to accuse locals of witchcraft including Tituba, a slave, and Sarah Good, a homeless beggar. A flurry of accusations followed, with residents piling on to denounce over 200 people. “Persons of ill-repute” and dedicated churchgoers alike were imprisoned and Bridget Bishop, “known for her gossipy habits and promiscuity”, was the first to be hanged on 10 June. Twenty people were put to death in total with several others dying in prison.

What caused those strange symptoms in Betty, Abigail, and their friends over three centuries ago, and ultimately led to all those deaths?

One popular theory, proposed by Linnda Caporael in Science in 1976, is that it was caused by rye fungus. The parasite, ingested accidentally from infected crops, causes “convulsive ergotism” – muscle spasms, hallucinations, and seizures. Others blamed the psychoactive jimsonweed (devil’s snare). Later, encephalitis lethargica, a mysterious sort of sleeping sickness possibly caused by an environmental toxin, a bacterial or viral infection or an autoimmune disorder, was invoked.

If you enjoy this, you may also like:

But these ideas have since been dismissed. For instance, key symptoms of ergot poisoning from rye fungus were absent in the Salem girls, including prominent gastrointestinal complaints, a livid skin colour, and ravenous appetites. And whilst ergot poisoning might cause LSD-type perceptual distortions (rainbow-like colours, halos, persistent after-images), the girls described well-defined figures attacking them instead.

Now a new candidate has emerged, proposed by Michael Zandi, a neurologist at University College London, and one of his students, Johnny Tam, in the Journal of Neurology. That candidate is anti-NMDAR encephalitis.

Here’s the story of a typical patient. She initially develops a flu-like illness. Within weeks, she becomes obsessed by god or the devil, consumed by paranoia and racked with insomnia. Now, she repeats the same words, then is struck mute. Next: seizures, writhing and contorted limbs, odd repetitive movements of the mouth and tongue. Her pulse races or slows, her blood pressure rises and falls. She sweats, drools, grunts and grimaces. She becomes catatonic and then comatose.

For so long, these patients were often diagnosed as hysterics and maligned as neurotics, sent to asylums to become madder still, or to die. But now we know the condition is caused by a neurological disorder following ground-breaking research in 2007, which has shown that an offending antibody reacts against NMDA receptors – hence the term anti-NMDAR encephalitis (the ‘R’ stands for receptors).

These receptors are responsible for the synaptic transmission of signals across the brain’s synapses, and neuroplasticity – the brain’s capacity to adapt and change – in addition to behaviour, learning and memory. The antibody attack in patients with anti-NMDAR encephalitis seems to arise as part of an autoimmune response, perhaps one that occurs in the aftermath of an infection (a triggering virus such as herpes has been suggested but the jury is still out on this one).

Some women with anti-NMDAR encephalitis have been found to have an ovarian tumour called a teratoma – a mass made up of hair, teeth, and bone. These tumours also have neural tissue which expresses NMDA receptors. Once again the immune system might be to blame – it’s likely that these receptors trigger the production of antibodies, which then cross-react with the brain’s NMDA receptors as well as those of the teratoma.

Intriguingly, ketamine is also an antagonist of these receptors, which is why a ketamine overdose produces similar symptoms to anti-NMDAR encephalitis.

Treatment to suppress the immune system sees 75% of patients with anti-NMDAR encephalitis fully recover or at least substantially so (although spontaneous improvement has been seen). For those who have an ovarian teratoma – remove this and the bewitched are de-witched. The condition has now also been identified in men, in young and old, but women are most commonly affected, frequently in their early 20’s.

So could this condition be linked to Salem? Zandi and Tam analysed descriptions of Betty and Abigail and they think it’s a distinct possibility for the following reasons:

  • Anxiety and persecutory delusions feature in anti-NMDAR encephalitis and seem to have been present in the Salem girls.
  • Seizures occur in encephalitis. The girls had “several sore fits’’.
  • The dyskinesias (involuntary limb movements) of anti-NMDAR encephalitis might match the following description: ‘‘Their limbs wracked and, tormented so ... their arms, necks, and backs turned this way and that way, and returned back again”.
  • There are parallels between the loss of inhibition and altered mental status of encephalitis and this account: ‘‘She was at first hurryed with violence to and fro in the room ... and begun to throw fire brands, about the house...’’
  • The suggestion that the girls were hallucinating: “Sometimes making as if she would fly, stretching up her arms as high as she could, and crying Whish, Whish, Whish!...’’
  • The fact that the girls were occasionally “taken dumb”, perhaps suggestive of catatonia.
  • Brain swelling can impair speech. The girls’ “mouths stopped, their throats choked...’’

“Their illnesses seem uncannily similar to a disease we’ve only got a handle on in the 21st Century,” says Zandi. “And why would anti-NMDAR encephalitis not have been present then?”

It sounds compelling, but some questions remain unanswered. Why would the cousins have simultaneously developed a condition that isn’t infectious? Zandi points to the heritability of other autoimmune conditions, so it is possible that both suffered from the same condition, but he recognises that “yes, it’s more likely that only one had it than both".

As for the rest of the girls, a great deal of mystery persists, says Zandi. “Socio-political factors may have underpinned other cases, and perhaps other medical conditions may have been mislabelled as witchcraft including epilepsy," he says.

Psychologist Nicholas Spanos also invoked the role of other factors, viewing the episode as a “sociopolitical drama played out in terms of the worldview shared by seventeenth-century Puritans”. The girls enacted the role of demoniacs, perhaps unwittingly so, and those roles were learned in and legitimised by this religious community: “As soon as she [the accused witch] came near all fell into fits.” They reported being bitten when the accused bit her lip in court. When she moved her hand, they said they’d been pinched. Tellingly, they reportedly appeared healthy outside the courtroom: “Many of these afflicted persons, who have scores of strange fits in a day, yet in the intervals of time are hale and hearty, robust and lusty, as tho’ nothing had afflicted them.”

Still, the possibility of anti-NMDAR encephalitis affecting even one of the girls is intriguing, even if socio-political and religious influences drove the rest. It follows a suggestion that the 14-year-old whose story inspired The Exorcist moviehad the same form of encephalitis. Admitted to a Missouri hospital in 1949, he exhibited extreme rage, “shouts in unknown tongue”, and “bouts of contorted postures into seemingly impossible shapes”.

As for Salem, a reprieve in May 1692 saw the release of about 150 accused witches. One of the “afflicted” girls, Ann Putnam Jr, formally apologised, writing a letter to the church in Salem village in 1706. Betty Parris is believed to have later married and raised a family in Sudbury. The fate of Abigail Williams remains unknown. Theories around the “afflicted” have abounded; now anti-NMDAR encephalitis has taken its place in line. Others will surely follow.

Join 900,000+ Future fans by liking us on Facebook, or follow us on Twitter or Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Culture, Capital, and Travel, delivered to your inbox every Friday.