The 63-year-old chief executive couldn’t do his job. He had been crippled by migraine headaches throughout his adult life and was in the middle of a new string of attacks. “I have but a little moment in the morning in which I can either read, write or think,” he wrote to a friend. After that, he had to shut himself up in a dark room until night. So President Thomas Jefferson, in the early spring of 1807, during his second term in office, was incapacitated every afternoon by the most common neurological disability in the world. The co-author of the Declaration of Independence never vanquished what he called his “periodical head-ach,” although his attacks appear to have lessened after 1808.

Two centuries later 36 million American migraine sufferers grapple with the pain the president felt. Like Jefferson, who often treated himself with a concoction brewed from tree bark that contained quinine, they try different therapies, ranging from heart drugs to yoga to herbal remedies. Their quest goes on because modern medicine, repeatedly baffled in attempts to find the cause of migraine, has struggled to provide reliable relief.

Now a new chapter in the long and often curious history of migraine is being written. Neurologists believe they have identified a hypersensitive nerve system that triggers the pain and are in the final stages of testing medicines that soothe its overly active cells. These are the first ever treatments specifically designed to prevent the crippling headaches before they start. If they deliver on the promise they have shown in studies conducted so far, including two recent phase III clinical trials, millions of headaches may never happen.

“It completely changes the paradigm of how we treat migraine,” says David Dodick, a neurologist at the Mayo Clinic’s campus in Arizona and a past president of the International Headache Society. Whereas there are migraine-specific drugs that do a good job stopping attacks after they start, the holy grail for both patients and doctors has been prevention.

Migraine attacks, which affect almost 730 million people worldwide, typically last from four to 72 hours. Most sufferers have sporadic migraines and are laid low during 14 or fewer days a month. Those with a chronic form—almost 8 percent of the migraine population—suffer 15 or more monthly “headache days.” Attacks are often preceded by fatigue, mood changes, nausea and other symptoms. About 30 percent of migraine patients experience visual disturbances, called auras, before headaches hit. The total economic burden of migraine in the U.S., including direct medical costs and indirect costs such as lost workdays, is estimated at $17 billion annually.

In the 5,000 years since migraine symptoms were first described in Babylonian documents, treatments have reflected both our evolving grasp and our almost comical ignorance of the condition. Bloodletting, trepanation and cauterization of the shaved scalp with a red-hot iron bar were common treatments during the Greco-Roman period. The nadir of misguided remedies was probably reached in the 10th century A.D., when the otherwise discerning ophthalmologist Ali ibn Isa recommended binding a dead mole to the head. In the 19th century medical electricity had become all the rage, and migraine patients were routinely jolted with a variety of inventions, including the hydroelectric bath, which was basically an electrified tub of water.

By the early 20th century clinicians turned their attention to the role of the blood vessels, inspired in part by observations of strong pulsing of the temporal arteries in migraine patients, as well as patients’ descriptions of throbbing pain and the relief they got from compression of the carotid arteries. For decades to come, migraine pain would be blamed primarily on the dilation of blood vessels (vasodilation) in the brain.

That idea was reinforced in the late 1930s with the publication of a paper on the use of ergotamine tartrate, an alkaloid that was known to constrict blood vessels. Despite an array of side effects, among them vomiting and drug dependence, it did stop attacks in a number of patients.

But if vasodilation was part of the puzzle, it was not the only thing going on in the brains of migraine sufferers, as the next wave of treatments suggested. In the 1970s cardiac patients who also had migraines started telling their doctors that the beta blockers they were taking to slow rapid heartbeats also reduced the frequency of their attacks. And migraine sufferers taking medicines for epilepsy and depression, and others receiving cosmetic Botox injections, reported relief. So headache specialists began prescribing these “borrowed” drugs for migraines. Five of the medications eventually were approved by the FDA for the condition. Unfortunately, it is still not known exactly how the adopted drugs (which are effective in only about 45 percent of cases and come with an array of side effects) help migraines. Dodick says they may act at various levels of the brain and brain stem to reduce excitability of the cortex and pain-transmission pathways.

The first migraine-specific drugs, the triptans, were introduced in the 1990s. Richard Lipton, director of the Montefiore Headache Center in New York City, says triptans were developed in response to the older idea that the dilation of blood vessels is the primary cause of migraine; triptans were supposed to inhibit it. Ironically, subsequent drug studies show that they actually disrupt the transmission of pain signals in the brain and that constricting blood vessels is not essential. “But they work anyway,” Lipton says. A survey of 133 detailed triptan studies found that they relieved headache within two hours in 42 to 76 percent of patients. People take them to stop attacks after they start, and they have become a reliable frontline treatment for millions.

What triptans cannot do—and what Peter Goadsby, a neurologist at the Headache Center at the University of California, San Francisco, has dreamed about doing for more than 30 years—is prevent migraine attacks from happening in the first place. In the 1980s, in pursuit of this goal, Goadsby focused on the trigeminal nerve system, long known to be the brain’s primary pain pathway. It was there, he suspected, that migraine did its dirty work. Studies in animals indicated that in branches of the nerve that exit from the back of the brain and wrap around various parts of the face and head, overactive cells would respond to typically benign lights, sounds and smells by releasing chemicals that transmit pain signals and cause migraine. The heightened sensitivity of these cells may be inherited; 80 percent of migraine sufferers have a family history of the disorder.

Goadsby co-authored his first paper on the subject in 1988, and other researchers, including Dodick, joined the effort. Their goal was to find a way to block the pain signals. One of the chemicals found in high levels in the blood of people experiencing migraine is calcitonin gene–related peptide (CGRP), a neurotransmitter that is released from one nerve cell and activates the next one in a nerve tract during an attack. Zeroing in on CGRP and interfering with it was hard. It was difficult to find a molecule that worked on that neurotransmitter and left other essential chemicals alone.

As biotech engineers’ ability to control and design proteins improved, several pharmaceutical companies developed migraine-fighting monoclonal antibodies. These designer proteins bind tightly to CGRP molecules or their receptors on trigeminal nerve cells, preventing cell activation. The new drugs are “like precision-guided missiles,” Dodick says. “They go straight to their targets.”

It is that specificity, and the fact that scientists actually know how the drugs work, that has Dodick, Goadsby and others excited. In two placebo-controlled trials with a total of 380 people who had severe migraines up to 14 days per month, a single dose of a CGRP drug decreased headache days by more than 60 percent (63 percent in one study and 66 percent in the other). Phase III clinical trials of two drugs, described in November 2017 in the New England Journal of Medicine, confirmed the efficacy of the approach. The drugs, erenumab and fremanezumab, were tested on a total of 1,395 patients and significantly reduced migraine frequency. So far the CGRP drugs, which are given as injections, work better at prevention than any of the borrowed heart or epilepsy drugs and have far fewer side effects.

Migraine specialists are also exploring other treatments, including forehead and eyelid surgery to decompress branches of the trigeminal nerve, as well as transcranial magnetic stimulation (TMS), a noninvasive way of altering nerve cell activity.

Lipton says he has had some good results with TMS. He has also referred patients for surgical interventions but says the experience “has been disappointing,” and he is not recommending it. For his part, Goadsby views surgeries and high-tech efforts as a kind of desperation: “They strike me as a cry for help. If we better understood migraine, we’d know better what to do.”

Even though the cause now appears rooted in the trigeminal nerve system, the origin of its overactive cells is still a mystery, Goadsby says. “What’s the nature of what you inherit when you inherit migraine?” he asks. “Why you, and why not me?” If researchers untangle the genetics of migraine, Jefferson’s “periodical head-ach” may loosen its painful modern grip.