Mathilde Tissier was no mad scientist. A doctoral candidate in biology at the University of Strasbourg, she was trying to help save the common hamster—an animal that, in just a few decades, had gone from an agricultural pest to an endangered species across nearly all of Europe. The disappearance had been especially swift in Alsace, a wine-growing region in eastern France where the hills are freckled with the red roofs of half-timbered homes. Tissier was breeding hamsters in order to study their diet, but one of the first births did not go as expected. The hamster delivered her seven pups outside of the cozy nest she had built in her cage and moved them onto her food hoard. When Tissier checked the next morning, all that remained of the hamster pups were a few bloody scraps among the kernels.

Most people think of a hamster as something between a pet and a plaything. It lives and breathes like any other animal, but it’s also cheap, low maintenance and easily replaceable like a toy. No one expects an escaped pet hamster to survive long, which is why it surprises many people to learn that hamsters have been living in the fields of Europe for millennia. The common hamster, as the wild species is known, is about the size and shape of a sweet potato, with calico fur, beady dark eyes and half-moon ears. It originated on the steppes of central Asia and spread westward at the end of the last ice age, settling in the same soft soils that humans were beginning to cultivate. Hamsters ate the crops around their burrows and sometimes destroyed swaths of farmland during population explosions, when as many as 2,000 crowded into a single hectare. Farmers killed hamsters to protect their crops and sell their fur, which was fashionable throughout Eastern Europe. (About a hundred hamsters are killed to make every hamster-fur coat.) In 1966, trappers in Saxony-Anhalt in East Germany killed more than a million hamsters in a single season.

Scientists expected the hamster to bounce back after most Western European countries banned trapping in the 1980s and ’90s. A female typically produced three litters of 6 to 12 pups every summer, which meant hamsters should have quickly repopulated the fields. But their numbers continued to plummet. In 2001, there were just 1,167 hamster burrows in Alsace. By 2012, there were 206.

Not since the passenger pigeon, perhaps, had an abundant animal disappeared as quickly as the hamsters. Intensive agriculture was making the countryside increasingly inhospitable for wildlife. Something was causing widespread decline in the hamsters: field biologists counted fewer and fewer hamsters emerging from their hibernation burrows every year. The species cannot survive without reproducing quickly, since most hamsters only live a year or two before falling prey to a fox, polecat or raptor. “It’s like the job of a hamster is to be eaten,” says Peer Cyriacks, an environmental biologist with the German Wildlife Foundation.

In 2008, the European Commission issued a stern warning. “When a European mammal like the great hamster approaches extinction, nature is sending a message,” the EU’s environment commissioner said in a press release. “We are beginning to damage our ecosystems beyond the point of repair. France must heed this warning and implement our nature protection legislation in full as soon as possible.”

Three years later, the European Court of Justice threatened France with a fine as high as $24.6 million if it failed to better protect the hamsters. (Germany, the Netherlands and Eastern European countries also had dwindling hamster populations, but France was singled out because a concerned citizen in Alsace filed a complaint.) Most biologists agreed that the problem had to do with modern agricultural practices. “There must have been something happening in the ’70s and ’80s,” says Tobias Reiners, a biologist at the Natural History Museum in Frankfurt. “It’s probably the Green Revolution.”

Many Alsatian towns are named in German dialect after the crops that used to grow there: Krautergersheim was famous for cabbage; Gerstheim, for wheat. The hamsters once foraged for a variety of plants, but the Green Revolution changed things. In the mid-20th century, farmers began boosting production with high-yield crops, new machinery and chemical fertilizers, herbicides and pesticides. They stopped growing crops on a seasonal rotation. Instead, they focused on monocultures that could be sold on the global market. The lack of crop diversity depleted the soil of nutrients, bacteria and insects.

On a sunny afternoon last May, Charlotte Kourkgy, a biologist in charge of one of the French government’s hamster conservation programs, took me into a barren cornfield and let a handful of sediment sift through her fingers. “The soil is so poor,” she said. “There’s nothing. It’s just sand.”

The hamster population in Alsace dropped sharply during the same decades in which corn came to dominate the region. These days, corn covers between half and 80 percent of Alsace’s farmland in a given year. By 2015, an Alsatian hamster had, on average, fewer than one litter per season with just one to four pups.

Tissier suspected that the reproductive failure had something to do with the lack of variety in the hamster’s diet. The typical cornfield is at least five acres, while a common hamster’s home range is less than a tenth of that size. Most hamsters in a cornfield will never encounter another plant species.

It was hard to pinpoint the problem, however, because the hamsters gave birth underground and field biologists could only count the pups when they were old enough to emerge. Thankfully, the University of Strasbourg had created a captive colony of common hamsters in the early ’90s, before the animals were legally protected.

Tissier began her experiment in 2014. She fed the lab hamsters every morning with either corn or wheat, the two main crops in Alsace, as well as an afternoon supplement of earthworm or clover. She predicted the hamsters on the corn-earthworm diet would give birth to the largest litters and heaviest pups. Instead, she was shocked when the first of these hamsters ate her litter. Her dismay turned to panic when, over the next two weeks, every single hamster in the corn-earthworm group cannibalized her newborns.

Tissier wondered if it was a lack of maternal experience: Young rodent females sometimes kill their first litter. So she bred all the worm- and cornfed hamsters a second time. “Every time I left in the evening, I hoped that this time the litter would still be there in the morning,” Tissier says. But every hamster except for one cannibalized her second litter, and one of the surviving pups ate its siblings as soon as their mother weaned them.

Tissier showed up in tears at the office of her PhD supervisor, Caroline Habold. “The unexpected cannibalism gave me the impression that I was doing something wrong,” Tissier says. Habold shared Tissier’s shock, but she encouraged her student to stick with the experiment. “Negative results have to be taken into account,” she counseled. “We have to find an explanation.”

One by one, Tissier eliminated possible causes. The corn-earthworm combo was not deficient in energy, protein or minerals, and the corn did not contain dangerous levels of chemical insecticide. Tissier was running out of ideas when an organic corn farmer suggested she look into human diets and amino acids. The more research papers Tissier read, the more she realized she had not made an error in her experiment. The thing making her hamsters hungry for their own infants was the corn itself.

**********

Cases of pellagra are almost unheard of in the developed world today, but the disorder used to be an enormous public-health problem in Europe and the United States. It was first described in Italy and Spain in the 18th century, and it was endemic in the American South at the beginning of the 20th century, with a mortality rate as high as 40 percent. The disease was so frightening and poorly understood that some hospitals refused to treat pellagrous patients, and cities like Atlanta opened “pellagrasoriums.” The first signs were diarrhea and a symmetrical skin rash on the arms and neck, and advanced patients suffered from hallucinations, paranoia, tremors and depression. Pellagrous insanity was a frequent defense in murder trials, and pellagra was the main cause of death in Southern insane asylums.

Doctors had always recognized that pellagra plagued poor communities that subsisted on corn, but they could not figure out the connection. Some suspected a fungus on the corn, while others blamed new harvesting methods. In 1915, an American doctor named Joseph Goldberger performed an experiment in a Mississippi prison, where he fed 11 inmates on a diet made almost entirely of grits and other corn-based foods. After six months, all of the prisoners had developed pellagra. In another study, Goldberger was able to eliminate pellagra in an orphanage simply by feeding the children fresh vegetables, milk, meat and eggs. Corn, he realized, must lack a nutrient necessary for normal functioning. Later doctors were more precise: Corn binds vitamin B3, or niacin, so that the body cannot absorb it during digestion.

Doctors quickly eradicated pellagra in the United States and Europe with vitamin B3 supplements and balanced diets. Pellagra still breaks out in the developing world—though not, interestingly, in Latin America, where corn is most popular. For centuries, Latin American people have treated corn with lime, which releases the bound niacin for absorption.

This treatment is not typically used in African countries, where pellagra outbreaks still occur. In the summer of 2015, George Matapandeu, a health worker in rural Malawi, began seeing hundreds of patients with diarrhea and symmetrical rashes. “In Malawi, I would say 70 percent of the time somebody says ‘I’ve consumed food,’ they mean corn,” Matapandeu says. After consulting with doctors in the United States, he started handing out vitamin B3 supplements. Within a few weeks the rashes and other symptoms had disappeared.

At the same time as Matapandeu was treating pellagra in Malawi, Tissier was wondering if a vitamin supplement might restore her hamsters’ maternal instincts. Looking back, she realized that the pups in the surviving litter from the corn-worm group had other pellagrous symptoms, like diarrhea and hair loss. She tested the earthworms and found that they contained almost no vitamin B3.

So she and Habold designed a new experiment, where they fed the hamsters corn, earthworms and a vitamin B3 supplement. When the first hamster in the group cannibalized its litter, Tissier worried that pellagra was another false lead. But every subsequent hamster that gave birth weaned her pups, and the first hamster successfully weaned a second litter. Tissier had solved the mystery and corrected the cannibalism. The next question was whether her new knowledge could save hamsters in the wild.

**********

Last summer, Kourkgy, the biologist working for the French government’s hamster program, noticed a strange photo from a camera trap in a cornfield. It showed a hamster carrying another animal in its mouth. Wild hamsters sometimes capture voles, but this hamster’s prey had no tail and looked underdeveloped. Kourkgy showed the photo to Tissier, who was preparing with Habold to submit the cannibalism study to the Proceedings of the Royal Society. “That’s it!” Tissier said.

The photo, though blurry, is the clearest evidence that the cannibalism is actually happening in the wild. Tissier and Habold designed a new experiment with semi-natural outdoor enclosures, seeded with different plants, where the hamsters could dig their own burrows. Once again, the corn-fed hamsters had widespread reproductive failure.

“I believe this behavior might be very common, especially during spring when hamsters emerge from hibernation and only have the seeds they hoarded the previous summer, or the corn seeds that were just sown,” says Tissier, who has since finished her PhD. “At that time in cornfields, there is absolutely nothing else to eat.”

Kourkgy and her team have been working with local farmers to implement hamster-friendly practices. They’ve created several experimental plots, where they try to come up with beneficial crop mixtures. The French government has been paying farmers to mix other plants, like clover, in with cash crops and to leave strips of crops unharvested so the hamsters can find cover from predators. Last spring, field researchers counted 523 burrows in Alsatian fields, the highest tally in recent years.

In October, the European Commission lifted its threat of a fine against France, a move that could lead to decreased funding for the hamster project. Julien Eidenschenck, a biologist who works closely with Kourkgy, worries that the decision was premature. “It’s just one year,” says Eidenschenck. “We should have an increase over two or three years in a row to confirm that the population is on a good trend.”

Most of the scientists I’ve spoken to still believe the hamster will disappear from European farmland in the next few decades. “When you extrapolate the data, the hamster will be extinct between 2020 and 2038,” says Stefanie Monecke, a German biologist who worked previously in Habold’s lab. Many see the breeding program as a temporary solution at best. As Cyriacks put it, “A team of nature freaks is not able to change the agriculture of Western Europe.”

Still, there are signs that wild hamsters are learning to adapt—not to a corn diet but to urban life. The best place to see a common hamster these days is not the French or German countryside but the city of Vienna. In some parks, you can find as many as eight hamsters per acre—more than ten times the density you find in Alsace. Common hamsters have also taken up residence in Eastern European cities like Moscow and Simferopol. They eat the plants that grow throughout the park, as well as human trash and leftovers; they have learned to climb trees to forage nuts and fruit. And unlike farmers throughout Europe, the Viennese have grown fond of their hamster neighbors. When Odile Petit, a colleague of Habold’s in Strasbourg, visited Vienna to photograph the hamsters, some pedestrians questioned her to make sure she wasn’t disturbing the animals.

In June, Petit released captive-bred hamsters at two large and rolling office parks in Strasbourg. Both locations have ideal soil and a variety of wild plants for the hamsters to eat. “Everything makes these areas attractive for many species, even if you have this anthropogenic presence,” says Petit, who will study the hamsters to determine whether they are adapting to the new landscape. The common hamster may never actually become common again in the French countryside, but if Petit’s experiment is successful, it may at least secure a future among the burghers of Strasbourg.

Editor’s Note: An earlier version of this article said that the human body needs niacin to produce tryptophan. In fact, the body synthesizes niacin from tryptophan.