Ants are good at lots of stuff. Carrying food, cutting leaves, biting people, and perhaps least well known: farming fungus. They're so good at farming, in fact, that they had unintentionally domesticated their fungus varietals long before humans got wind of farming. Or existed, for that matter.

This is not actually news to anyone who pays attention to the ant world. But if you're not up on your entomological periodicals, listen up. Did you know that leafcutter ants don't eat the leaves they chop up? They're harvesting plant material for their fungi gardens to grow on, so that they can then eat the fungi. These industrious little guys live mostly in tropical forests, where fungus thrives on the heat and moisture, but that's not where the domestication happened. And that's news.

In July 2016, entomologist Ted Schultz at the National Museum of Natural History—along with a team of other ant people—figured out that ants have been farming for up to 65 million years. At some point in that process, certain types of the fungi they farmed became dependent on ant colonies, and vice versa. The question was when and how. And in a paper published on Tuesday in the journal Proceedings of Royal Society B, Schultz and team figured out just that.

James DiLoreto, Smithsonian.

Entomologist Ted Schultz looking so very happy next to his ants.

Attine ants—those fungus farmers—vary in how dependent their funky crops are on the colonies that cultivate them. Some fungi can escape back into the wild and grow on their own. Those types are called “lower” fungi, whereas those varietals that have to grow inside ant colonies are termed “higher.” This seems unfair and backwards. Surely the fungus that can venture out on its own is the higher form of fungus. It makes more sense when you look at it from the ants' perspective. Some types of attine ants cultivate species of fungi that don't produce spores, which means they can't spread their own seed. Leafcutters feed their fungi with fresh leaves, while the other attines use dead biomass, but either way the effect is the same: a plush garden growing right in your colony.

But in a wet, warm environment like the tropics, it would be difficult for the fungus to become so dependent on ants. It would be too easy for spores to spread outside the nest and for populations of fungi to interbreed in and out of ant colonies. Schultz and company figured out what actually happened by looking at the evolution of ant agriculture and their fungal cultivars. Attine ants started farming in the rainforest, but domestication happened in drier climates like deserts or savannahs.

In these climes, the fungi grew best inside the comparatively moist underground colonies that their ant overlords created. Over time, this turned into an inability to grow outside of the nest, because they were genetically incapable of doing so. And similarly, the ants lost the ability to make a key amino acid, asparagine, which the fungus provides them. And voila: mutual dependence. By the time some of these attine farmers moved back into the rainforest, their symbiotic relationships were cemented.

Cauê Lopes. Ted Schultz, Smithsonian.

Ted Schultz and team in the process of excavating an ant fungus farm

All this happened about 30 million years ago, during a time of general cooling when dry climates were more common (and some 35 million years after ants started farming in the first place). It's also millions of years before humans figured out the whole agriculture thing, though to be fair we were a little behind on the evolutionary timeline at that point. We, unlike ants, could understand that as crops underwent changes we could actually select for traits that helped us cultivate the plant. Domesticated wheat lost its bursting seed pods such that it's close to impossible for it to reproduce on its own anymore, in much the same way that the ants' fungi lost their spores. It's just that ants did it unintentionally. So chalk up another one for the ants—if they ever decide to rise up and revolt, we're screwed.