Life history and sex allocation in the simultaneously hermaphroditic polychaete worm Ophryotrocha diadema: the role of sperm competition.  Sex allocation theory predicts that, in hermaphroditic organisms, individuals allocate a fixed amount of resources divided among male and female functions to reproduction and that the proportion devoted to each sex depends on the mating group size. As the mating group size increases, hermaphrodites are predicted to allocate proportionally more resources to the male and less resources to the female function (approaching equal allocation to both sexes) to face increased sperm competition. Up to now little experimental evidence has been provided to support the theory in hermaphroditic animals. Facultative shift between male and female allocation in response to variation in local group size does occur in several taxa but not always in the expected direction and not with similar patterns. In the protandric and then simultaneously hermaphroditic polychaete worm Ophryotrocha diadema reproductive resources are flexibly allocated in the protandrous and the hermaphroditic phase. The cost of male reproduction during adolescence is spread over the whole energy budget of the animal as shown by the shortening of lifespan and the lowering of growth rate in individuals with enhanced male expenditure during the protandrous phase. Moreover, in this species, short term sex allocation adjustments differ from those described in other taxa. Individuals regulate their reproductive output so that where reproductive competitors are present, the number of female gametes is strongly reduced but the number of male gametes (although it changes) is not significantly increased. Resources subtracted from the female function are not directly allocated to sperm production, but to expensive male behaviors that are likely to enhance male reproductive success. These results are discussed in the light of the relevance of sexual selection in large populations of hermaphrodites.