Habitat clearance and fragmentation is increasingly threatening the biodiversity of tropical rainforests, however, the response of many insect species, even of key organisms, is still little understood. Using an extensive data set spanning over four years, we analyzed the effects of clearance and fragmentation of a Congo-Guinean rainforest in western Kenya on the abundance and the raid rates of two species of swarm-raiding army ants, which are considered keystone organisms of tropical rainforests. The abundance of army ants was measured by transect monitoring and by short-term pitfall trapping while raid rates were measured by long-term pitfall trapping over a period of five months. Dorylus wilverthi was the most abundant army ant in undisturbed rainforest and its abundance and raid rate strongly declined in small forest fragments. In contrast, the abundance of Dorylus molestus increased with decreasing fragment size and compensated for the decline of D. wilverthi in terms of abundance and ecological functionality (i.e. raiding rates). D. molestus appears to have a higher ability of using the agricultural land surrounding the Kakamega Forest than D. wilverthi, which may explain the species-specific differences in the susceptibility to habitat fragmentation. Our study demonstrates that habitat fragmentation may have a differential effect on two ecologically highly similar keystone species. Moreover, it shows that species compensation might help in maintaining an important ecosystem function (i.e. raiding by swarm-raiding army ants) in fragmented tropical rainforests. (C) 2008 Elsevier Ltd. All rights reserved.