Sixty-five million years ago, something, probably an extraterrestrial fireball that smashed into the planet, caused huge numbers of species to go extinct. The K-T extinction marked the end of the dinosaur age. Not all animals, though, were so devastated. T. rex vanished. The humble ant carried on.

Some ants not only carried on but found innovative ways to flourish. An evolutionary study published Tuesday in the journal Proceedings of the Royal Society: B traced the origins of ant agriculture to the K-T event. What may have been the planet's very first farmers — ant colonies that carved out underground chambers, where they grew gardens of nutritious fungi — appeared between 61 million and 57 million years ago, according to a new phylogenetic tree created by biologists at the Smithsonian Institution and Louisiana State University.

“The K-T boundary must have created tremendous novel empty niche space where surviving organisms could 'experiment' with wild innovation without being wiped out by traditional competitors right away,” Jacobus J. Boomsma, an expert in fungus-farming ants at the University of Copenhagen who was not involved with the new research, wrote in an email.

Smithsonian entomologist Ted R. Schultz, a co-author of the new report, called his K-T extinction explanation a bit of a hand wave. “It isn't like we proved cause and effect. But it fits the dating,” he told The Washington Post. “It’s a pretty nice circumstantial argument.” It could also be cribbed from a dystopian sci-fi flick: The equivalent of a nuclear winter forced the insects to spend more time below the surface. There, the underground colonies survived by cultivating and harvesting fungi. A splinter group, which did not learn to grow food, became picky subterranean hunters.

The split between these hunter and farmer sister groups marked a crucial point in ant evolution. “The innovation point comes out clearly,” Boomsma said, “one lineage of specialized predators (this is rare among the evolutionary derived ants) and one lineage inventing fungus farming.”

To create the evolutionary tree, Schultz and his colleagues compared DNA sequences from 119 living ant species, 78 of which are fungus farmers. Schultz, who had spent decades collecting fungus-farming ants and studying their genetic history, described this effort as a “quantum leap” beyond his previous work.

Linking this evolutionary data to geographic history gave biologists a glimpse of ancient ant relationships. “We try to reconstruct history, basically,” Schultz said. The scientists focused on finding common ant ancestors, as well as pinpointing what sort of habitat these animals lived in.

Previous research indicated that ants evolved their fungus-farming behavior in South American rain forests. The new evolutionary tree supported that hypothesis. The entomologists also homed in on the point when ants developed larger-scale agriculture. A curious picture emerged. The most massive fungal farming operations were probably a result of ants living in savannas or other dry climates, not tropical forests.

Biologists divide farming ants into two broad groups: “lower” and “higher” fungus farmers. (Boomsma was wary of the terms lower and higher, preferring “subsistence agriculture” and “farming of domesticated cultivars,” respectively.) The major division between the two belonged not with the ants, but with the fungi.

“In lower ant agriculture, the ants are obligate symbiotes — they have to grow fungus to survive. But the fungi,” Schultz said, “they are perfectly capable of living without the ants.” For higher ant agriculture, neither the ants nor the crops can live without each other. “The fungus is stuck with the ants. It has no other options.”

About 30 million years ago, as the climate in South America cooled and dry habitat became more abundant, ants began to farm outside of a forest environment. These crops were, at first, similar to the fungi grown by subsistence ants. But something happened to the fungus in the dry climate. It could no longer escape the ant gardens or interbreed with wild fungi. In savannas, the fungi “can't survive for most of the year,” Schultz said. “Even if it could, there’d be nobody to mate with.”

But theirs was not an unhappy exclusive relationship. To keep the fungus alive, the ants developed ways to control the garden climate. Today's ants dig chambers as far as 12 feet underground, to be closer to the water table. They can alter moisture content and air flow in the gardens. “It's very much like greenhouse agriculture,” Schultz said.

Within these hospitable chambers, the stage was set for the insect equivalent of domestication. “The ‘out of the rain forest’ domestication result is also very interesting,” Boomsma said. “That really changes the way we think about the history of ant farming.”

The movement into savannas changed the future of ant farming. The fungi became polyploid, which is to say the fungi had more than the usual two chromosome sets. Cultivated strawberries and seedless watermelons are polyploid, too. (Polyploid crops tend to be more productive, though they frequently lose the ability to reproduce on their own.) This dry cultivar was the ancestor for fungal varieties currently grown by leaf cutter ants, which, as Boomsma noted, practice farming on an “industrial scale.”

A single colony of leaf cutter ants has the ecological impact of a large plant-eating mammal. If you took all of the ants out of a leaf cutter colony and weighed them, their collective mass would be “somewhere in the neighborhood of a cow,” Schultz said. You'd probably have to weigh all of the fungus, too, as this functions as the colony's digestive system.

Compared with their subsistence farmer cousins, leaf cutter ants, which first appeared about 10 million years ago, are sophisticates. These ants specialize into “small, large and soldier workers with different complementary tasks,” Boomsma said, which enables “industrial-scale conveyor-belt processing of freshly cut leaves.”

These industrial fungus-farming ants may hold lessons for human medicine. In 2014, scientists in the United States and Brazil announced a project to study the relationship between leaf cutter ants and fungus, looking for new sources of antiparasitic and chemotherapeutic drugs.

Ants have practiced sustainable agriculture for millions of years, Schultz noted. Their gardens are not blight-free. But the insects are able to keep unwanted guests in check by, for instance, developing symbiotic relationships with pest-killing bacteria. Perhaps, he said, human farmers can learn from these wee laborers. “For 60 million years, the ants have been doing this,” Schultz said. “If you want to be an agriculturist, why wouldn’t you want to look at some other successful agriculturalists?”

Read more: