In diverse animal species, from insects to mammals, females display a more efficient immune defence than males. Bateman’s principle posits that males maximize their fitness by increasing mating frequency whereas females gain fitness benefits by maximizing their lifespan. As a longer lifespan requires a more efficient immune system, these implications of Bateman’s principle may explain widespread immune dimorphism among animals. Because in most extant animals, the provisioning of eggs and a higher parental investment are attributes of the female sex, sex-role reversed species provide a unique opportunity to assess whether or not immune dimorphism depends on life history and not on sex per se. In the broad-nosed pipefish Syngnathus typhle, males brood and nourish the eggs in a ventral pouch and thus invest more into reproduction than females. We found males to have a more active immune response both in field data from four populations and also in an experiment under controlled laboratory conditions. This applied to different measures of immunocompetence using innate as well as adaptive immune system traits. We further determined the specificity of immune response initiation after a fully factorial primary and secondary exposure to a common marine pathogen Vibrio spp. Males not only had a more active but also a more specific immune defence than females. Our results thus indeed suggest that the sex that invests more into the offspring has the stronger immune defence.