Domesticator-domesticate relationships are specialized mutualisms where one species provides multigenerational support to another in exchange for a resource or service, and through which both partners gain an advantage over individuals outside the relationship. While this ecological innovation has profoundly reshaped the world’s landscapes and biodiversity, the ecological circumstances that facilitate domestication remain uncertain. Here, we show that longfin damselfish (Stegastes diencaeus) aggressively defend algae farms on which they feed, and this protective refuge selects a domesticator-domesticate relationship with planktonic mysid shrimps (Mysidium integrum). Mysids passively excrete nutrients onto farms, which is associated with enriched algal composition, and damselfish that host mysids exhibit better body condition compared to those without. Our results suggest that the refuge damselfish create as a byproduct of algal tending and the mutual habituation that damselfish and mysids exhibit towards one another were instrumental in subsequent mysid domestication. These results are consistent with domestication via the commensal pathway, by which many common examples of animal domestication are hypothesized to have evolved.