A 26-year-old student from California thought he mad a migraine, but nope. He had a live tapeworm inside his brain.

After a month of intense pain, Luis Ortiz's mother drove him to the hospital where he started vomiting and eventually list consciousness.

Doctors ran tests and found that a a tapeworm larva had implanted itself inside his brain, forming a cyst that was blocking circulation.

"We made a hole in skull bone over the eyebrow and drove the camera into the centre of the brain and fished out the cyst and the worm… The worm was still wiggling when we pulled it out," Dr Soren Singel, one of the neurosurgeons who performed the emergency surgery, told the Napa Valley Register.

"Another 30 minutes of that blockage and he would have been dead. It was a close call," he said.