with the period of diversification of the cleptoparasitic genusLestrimelitta from non-parasitic ancestors (Fig. 1a). Lestrimelitta bees pose a threat to many Neotropical species as robbers of resources29 and are suspected to be the driving force behind the evolution of soldiers inT. angustula9,16. For example, T. angustula soldiers aggressively attack objects that chemically or visually resemble robber bees35 and colonies have more soldiers in areas where Lestrimelitta attacks are more common16. Ten of the 28 studied species are known victims ofLestrimelitta, whose attacks frequently destroy colonies29. We found that victims of robber bees are significantly more likely to have larger guards than non-target species (70% vs. 16.7%). Having larger guards could benefit colonies as body size is likely to affect the ability to fight off intruders9.Four of five transitions towards increased guard size occurred during the last 10 million years, a time period of global cooling36 and an increase in seasonality37. It is possible that these climatic changes further amplified the need to store and defend energy sources, such as honey and pollen. Michener38, for example, observed that stingless bees store more honey in cooler climates. In honey bees, the need for colony defence dramatically increases as foraging conditions worsen towards winter and colonies start to rob honey from other colonies39. However, honey bees and eusocial wasps might not need specialist soldiers because all workers are equipped with a powerful sting5. In stingless bees, the emergence of dangerous robbers and an environment that favored the storage of valuable resources might represent two important incentives for having larger and, therefore, stronger entrance guards. Previous studies have shown that a more dangerous environment can lead to increased investment in colony defence in species that already have soldiers16,40. Our study extends this theme and identifies a specific threat (Lestrimelitta robber bees) as a possible selective force for the evolution of new sub-castes and increased social complexity in Neotropical stingless bees.MethodsStudy speciesColonies originated from five different regions in Brazil (Supplementary Table 1). We used both wild colonies and colonies kept in wooden hive boxes. All colonies foraged on natural food sources. We estimated relative colony size by measuring colony traffic at the entrance16. We counted bees entering a colony for 12 min on a day with good foraging conditions, once in the morning and once in the afternoon (between 10 a.m.12 noon and 1 p.m.3 p.m.). For analysis, we averaged the measurements per colony and the colony measurements per species to obtain a species specific estimate of relative colony size (Supplementary Table 1) (no traffic data was available for both time periods for Scaura latitarsis due to the remoteness of the sampling location). Our values correlate well with published colony size estimates (correlation-coefficient r = 0.88, N = 11 species; estimates taken from21).Capture of workersWe studied 3.8 1.8 colonies (mean s.d., range: 28) and 70.5 22.6 workers (range: 28123) per species (Supplementary Table 1; collection licenses: Ibama#26649-5 and SISBIO 27254-1). For forager collection, we caught returning pollen foragers at the colony entrance in 26 species. In the cleptoparasitic Lestrimelitta limao and the necrophagous Trigona hypogea, two species