Not all ants are hard workers. Some in the colony slave away only so others can avoid pulling their weight.

These freeloading hangers-on are known as social parasites, and they've essentially forged an evolutionary shortcut through the comforts of cooperative communities.

Instead of building a communal network themselves, social parasites merely exploit ones that already exist, either in their own species or a closely related one.

Researchers have noted this ruthless life strategy among insects, fish, birds, and mammals, including humans, but among ants, it has evolved at least 60 times, including some 400 socially parasitic species.

Where these moochers came from and why are questions even Darwin wasn't prepared to answer. Now, with modern genetic research, scientists are taking another stab at the origin story.

Reconstructing the evolutionary history of Formica ants, researchers have attempted to track the rise of social exploitation.

Formica ants are the perfect candidates for research like this as they include the most social parasite species of any ant genus. In fact, roughly half of all known Formica species get by this way.

Their genetic timeline has now traced their story right back to the beginning.

"This was a moment of clarity," says evolutionary biologist Christian Rabeling from Arizona State University.

"It's like you have all these different mosaic pieces. You place one stone here, another stone there, and then there's a new observation that adds yet another piece to the mosaic. But once you put in the evolutionary time context, all of sudden, you can see the entire picture. It's deeply satisfying."

For instance, there are three major classes of social parasitism, and while they might appear similar on the surface, they all seem to have evolved at separate points.

The first class is known as 'temporary social parasitism'. It occurs when ant queens somehow lose their ability to breed new colonies. This means they have to invade another's nest, kill the queen, and raise the offspring as their own to survive.

According to the new Formica ant timeline, temporary social parasites share a common ant ancestor that lived roughly 16 million years ago. In comparison, the common ancestor of all living Formica ants arose approximately 26 million years ago, which suggests temporary social parasitism only evolved recently.

What's more, it took another two million years for the second class of social parasitism to develop.

This type is known as 'dulotic social parasitism', and it begins the same as temporary social parasitism. First, an ant queen raids and steals another's nest. Then, once that queen has raised enough workers, her army raids another nest to capture their brood as well. The parasites then either feed on the stolen young or raise them as their own.

"[The workers] think they are right at home, so they don't even recognize that they are in a different species' nest," explains Rabeling.

Unlike temporary social parasitism, which seems to have evolved multiple times among several Formica species, dulotic social parasitism appears to have a single origin.

Charles Darwin himself was stumped by F. sanguinea when he wrote about them in On the Origin of Species.

At the time, Darwin suggested their strange lifestyle arose primarily as a way of acquiring food, but other scientists have since suggested it is to improve brood numbers or reduce nearby competition for territory.

The authors of the current analysis suggest all three factors are at play, as they are apparent among the ancestor of F. sanguinea.

The third and final class of social parasitism is permanent and extremely rare. It has only been confirmed among one type of workerless ant species, F. talbotae, although it has also been reported in, but not confirmed, another ant species as well.

Permanent social parasitism is a particularly odd class because both the invading ant queen and the host queen live together without ever really bothering one another. The host queen continues to produce her social network of workers like normal, while the parasite queen focuses on reproduction.

According to the Formica timeline, permanent social parasites like F. talbotae split off from temporary social parasites roughly 12 million years ago. In other words, they are the youngest class of social parasites.

One can only wonder what Darwin would think of them.

​​"For us, this is a fantastic period right now," says Rabeling. "Just the ability to ask these questions was probably the most exciting part of this study."

The study was published in PNAS.