When faced with limited resources, organisms have to determine how to allocate their resources to maximize fitness. In the presence of parasites, hosts may be selected for their ability to balance between the two competing needs of reproduction and immunity. These decisions can have consequences not only for host fitness, but also for the ability of parasites to persist within the population, and for the competitive dynamics between different host species. We develop two mathematical models to investigate how resource allocation strategies evolve at both population and metapopulation levels. The evolutionarily stable strategy (ESS) at the population level is a balanced investment between reproduction and immunity that maintains parasites, even though the host has the capacity to eliminate parasites. The host exhibiting the ESS can always invade other host populations through parasite-mediated competition, effectively using the parasites as biological weapons. At the metapopulation level, the dominant strategy is sometimes different from the population-level ESS, and depends on the ratio of local extinction rate to host colonization rate. This study may help to explain why parasites are as common as they are, and can serve as a modeling framework for investigating parasite-mediated ecological invasions. Furthermore, this work highlights the possibility that the 'introduction of enemies' process may facilitate species invasion.