The distribution of the arboreal ant community plus a termite species of the genus Nasutitermes was inventoried on 938 red mangrove, Rhizophora mangle L., trees in a completely flooded mangrove forest of the Sian Ka'an Biosphere Reserve, Quintana Roo, Mexico. Colonies sheltered in dry hollow branches of the trees and the pseudobulbs of the epiphytic orchid, Myrmecophila christinae. Two size classes of dry hollow tree branches were categorized in order to test differences in ant distribution. As some trees remained unoccupied by either an ant or a termite colony, we deduced that the competition for nesting sites was low. Differences in the composition of the ant community corresponded to the nature of the shelters (i.e. diameter of the hollow branches or orchid pseudobulbs). The ant fauna was richer in the large dry hollow branches of R. mangle than in the smaller ones, with certain ant species belonging to the subfamilies Ponerinae and Formicinae being significantly more frequent in the large dry hollow branches than in the small ones. Cephalotes and Pseudomyrmex were the most frequent ant genera inhabiting the dry branches of R. mangle, while Dolichoderus bispinosus was the most frequent ant species inhabiting the orchid pseudobulbs. Arboreal Nasutitermes sp. selected mostly the orchid pseudobulbs and thus indirectly interfered with ant nest-site selection. Our results highlight niche differentiation through the selection of nest sites among different types of shelter.