(CNN) After years of splitting headaches, a Texas man's long-awaited diagnosis was something out of a Google symptoms search nightmare: The aches were caused by tapeworm larvae that had taken up space in his brain.
The cyst of tapeworms could've killed him if he had waited any later to seek help, said Dr. Jordan Amadio, a neurosurgeon at Austin's Ascension Seton Medical Center. Luckily, Amadio's patient, Gerardo Moctezuma, finally sought that help when his headaches sent him into dizzy fainting spells.
"It's very intense, very strong, because it made me sweat...from the pain," Moctezuma, 40, told CNN affiliate KXAN. The pain often drove him to vomit.
MRI images revealed life-threatening pressure in Moctezuma's brain -- the result of tapeworm larvae that became lodged in the brain's fourth ventricle, filled with cerebrospinal fluid.
"We did get to him just in time," the doctor told CNN.
It's a condition called neurocysticercosis, which can cause neurological symptoms when larval cysts develop in the brain.
"That may not sound like a lot," Amadio said. "But when [the larvae] are in very high-priced real estate like the brain stem, that's huge."
Moctezuma's case was fairly rare, he said: There are around 1,000 cases of neurocysticercosis in the US every year, according to the US Centers for Disease Control and Prevention.
What's more, Amadio said the parasite likely entered Moctezuma's body while he was living in Mexico. But he'd moved to the US more than 14 years before his diagnosis -- so the tapeworm larvae might've been living in his body for more than a decade.
"Most cases like this don't present in this way," he said. "These cysts can grow for a number of years in the body. Where this problem is endemic, we do see more people infected with this tapeworm larvae than they're aware of."
Tapeworms typically take up residence in human's intestines -- some even pass on their own without medication -- but they're still a fairly uncommon ailment in the US, according to the CDC.
The parasite is commonly transmitted when people consume undercooked pork -- pigs are often intermediary tapeworm hosts -- or come in contact with food, water and soil contaminated with tapeworm eggs.
The best line of defense, Amadio said, is washing hands with soap before eating and only eating food you can ensure was cooked in sanitary conditions.
Moctezuma underwent emergency surgery to remove the tapeworms. Amadio opened a part of his skull near the brain stem and successfully removed the cyst in one piece.
Moctezuma made a full recovery after brain surgery, his doctor said. He's headache-free and back to work -- but his case is a reminder that just because neurocysticercosis rare doesn't mean it's impossible.
"This can be fascinating, but also important from a public health standpoint," Amadio said. "People need to be aware -- these are infections, not just in the developing world but here in the US. It's imperative to take universal precautions."