We used phosphorus magnetic resonance spectroscopy to assess in vivo the brain cytosolic free magnesium concentration and the free energy released by the reaction of adenosine triphosphate (ATP) hydrolysis (DeltaG(ATPhyd)), the latter being an index of the cell's bioenergetics condition. We studied 78 patients with migraine in attack-free periods (7 with migraine stroke, 13 with migraine with prolonged aura, 37 with migraine with typical aura or basilar migraine, and 21 with migraine without aura), and 13 patients with cluster headache. In the occipital lobes of all subgroups of migraine and in cluster headache patients cytosolic free [Mg(2+)] as well as the free energy released by the reaction of ATP hydrolysis were significantly reduced. Among migraine patients, the level of free energy released by the reaction of ATP hydrolysis and the cytosolic free [Mg(2+)] showed a trend in keeping with the severity of clinical phenotype, both showing the lowest values in patients with migraine stroke and the highest in patients with migraine without aura. These results support our current hypothesis that the reduction in free [Mg(2+)] in tissues with mitochondrial dysfunction is secondary to the bioenergetics deficit, and are against a primary role of low brain cytosolic free [Mg(2+)] in causing the bioenergetics deficit in headache.