One stormy afternoon in Ljubljana, the capital of Slovenia, thunder rolled, a bolt of lightning streaked across the sky, and the television and air conditioner went dark in the apartment of a woman with electrodes implanted in her brain.

Lightning had struck the building.

But the appliances were not the only things affected. After about an hour, the woman, who had had the electrodes put in five years before to help with debilitating muscle spasms in her neck, noticed her symptoms coming back. When she went to see her doctors the next day, they found that the pacemaker-like stimulator that powered the electrodes had switched itself off in response to the lightning strike.

In a study describing these events published Tuesday in the Journal of Neurosurgery, her doctors suggest that physicians and medical device companies add lightning strikes to the list of things patients with electrodes implanted in their brains should watch out for.

It may sound futuristic, but deep brain stimulation, or D.B.S., has a fairly long history. Surgeons operating on epileptic patients in the 1930s and 1940s found that removing small portions of the brain could quiet seizures. Later, researchers found that stimulating certain brain areas, instead of cutting them out, could quell the involuntary movements characteristic of Parkinson’s and other disorders.