When a 17-year-old guy in Mexico presented at the hospital with complaints about serious eye pain, the doctors were in for a squirmy surprise when they examined him.

Shining a light into the eyeball, they saw inflammation, blood, and several holes in the iris. And a worm - darting in and out of those holes, travelling around the front of the eyeball at its leisure.

The teenager, who lived in a rural town, had been suffering from decreased vision in his right eye for about three weeks. By the time he got to the doctor's, he could barely see through that eye, only able to detect movement when someone waved a hand in front of him.

Doctors identified the eye invader as a type of trematode - a class of parasitic flatworms commonly referred to as 'flukes' and easily identified by the suckers they use to burrow holes in the host's body.

Flukes are a ubiquitous parasite in vertebrates, and there's even one type that specialises in attacking fish eyeballs.

In humans though, flatworm infections are typically internal, with the worms setting up shop in places like liver, lungs, the intestines or perhaps blood. So, not in the eyes. Definitely not in the eyes.

"It is not common for trematodes to infect eyes; it is not common for any kind of worm to infect eyes," ophthalmologist Pablo Guzman-Salas, who treated the patient at the Institute of Ophthalmology in Mexico City, told LiveScience.

People can get a parasitic fluke infection in various ways, depending on the life cycle of the particular flatworm. Swimming in worm-egg tainted waters or ingesting the parasite through food will usually do the trick.

But it's a mystery as to how this particular teen got his extremely rare infection, because neither blood tests nor stool samples revealed any signs of a flatworm infestation.

"The patient reported no relevant food exposures, history of swimming in lakes, or other water exposure," the team writes in the case report.

They still gave the patient praziquantel tablets - first-line treatment for trematode infections - and then set about surgically removing the worm from the damaged eye.

To tackle the squirming menace, doctors cut open and lifted away the lens, and then removed the vitreous - the gel-like substance that fills our eyeballs, giving them shape.

The worm, which was only about 3 millimetres (0.12 inches) long, had to be chopped into smaller pieces to be removed, so the team didn't manage to identify the species.

Unfortunately, the surgery also revealed the parasite had managed to wreck extensive damage not only to the iris, but also to the retina at the back of the eye. The patient recovered from the surgery, but didn't regain normal vision.

"After 6 months of follow-up, the patient had no improvement in visual acuity in the right eye," states the case report.

Given the mysterious circumstances of this infection, there's probably nothing the teen could have done to avoid the worm ruining his eye. He was just really, really unlucky.

The case report was published in The New England Journal of Medicine. You can even see a video if you follow that link, but make sure you're not eating when you watch that.