I was three months into my stay in India when I realised that something unusual was happening to my mind. I had travelled alone to a remote area of Tamil Nadu in order to research my novel and teach at a local school.

I am used to having command of my words, but I began to find that simple ones would slip from my memory and I would be left speechless in front of a classroom of expectant pupils. Instead of "ran", I would say "runned" and "slept" would become "sleeped".

In the evenings, when I tried to write, my thoughts were frustratingly blank; I couldn't concentrate on anything for very long. I spent a lot of time crying: in spite of all the new experiences I was enjoying, I could not seem to keep myself emotionally steady.

After five months, I woke up early one morning to find my whole arm numb: the tingling that had started a few days earlier had spread from my thumb up to my neck. There was a wedding in the village next to ours and music was echoing around the hills outside. I knew I would not be able to get back to sleep, so I picked up a pen and jotted down the first sentence that came into my head: "It is there before I know about it, being born… My wave, heavy, like death." As it turned out, my words were an eerily prescient description of what was going on inside me.

In the afternoon, I walked to the children's home connected to the school to take my mind off the sensation in my arm. I was sitting with a group of girls when I felt one side of my face start to droop. My arms and legs began to flail, and I was thrown backwards on to the floor, where I fell into a fit.

I regained consciousness after a few minutes, but could remember very little of what had happened. When the girls tried to explain what they had seen, my first thought was that I had suffered a stroke – frightening given that I was only 21.

An hour after I recovered from the first fit, the drooping in my face returned and I fitted again. This time, I stayed unconscious for longer. The nearest hospital was a five-hour drive on potholed, unlit dirt tracks, but I knew I needed medical help. The family who ran the children's home wasted no time in driving me there.

At the hospital, I was given a brain scan and diagnosed with a tapeworm, which had become lodged in my brain tissue and formed several cysts. Left untreated, it would continue to develop and eat away at my brain cells, and the seizures would become increasingly serious.

I had known for a while that something was wrong, but now the problem gained shape in my imagination: I couldn't stop thinking about the fact that there was a foreign body inside me, feeding off my ability to write and speak.

It was only after I was flown back to the UK that I realised how lucky I was to have been treated by a local doctor familiar with the condition – he knew exactly how to kill the worm. He told me that pigs play a role in the parasite's life cycle, but given that I had not eaten meat, I had most likely inhaled an egg.

I took epilepsy medication to control the seizures and the worm was killed using a combination of steroids. In total, the treatment lasted a year and a half, during which time I could not drive or drink.

The disease is unheard of in Britain and without the medical notes given to me by the Tamil doctor, I would probably not have been diagnosed in time. The British doctors had no idea how to treat an illness that was so specific to the area in which I was staying.

I no longer suffer from the seizures and, while the scarring in my brain means I sometimes struggle to recall certain words, the worm and the cysts are gone for good. It was frightening as a novelist to realise that my language – the very medium I work with – was under threat. But it has made me more determined than ever to put words on to paper: they seem more precious now – as if, like youth or loved ones, they won't be with me for ever.

The words that I wrote in my notebook on the day of my first seizure went on to form the opening sentence of my first published novel – a story about the intimate knowledge that landscapes lend their inhabitants. It was this knowledge, shown by the Tamil doctor who treated me, that saved my life and my language.

• Do you have an experience to share? Email experience@theguardian.com