Histocompatibility is the basis by which multicellular organisms of the same species distinguish self from nonself. Relatively little is known about the mechanisms underlying histocompatibility reactions in lower organisms. Botryllus schlosseri is a colonial urochordate, a sister group of vertebrates, that exhibits a genetically determined natural transplantation reaction, whereby self-recognition between colonies leads to formation of parabionts with a common vasculature, whereas rejection occurs between incompatible colonies. Using genetically defined lines, whole-transcriptome sequencing, and genomics, we identified a single gene that encodes self-nonself and determines "graft" outcomes in this organism. This gene is significantly up-regulated in colonies poised to undergo fusion and/or rejection, is highly expressed in the vasculature, and is functionally linked to histocompatibility outcomes. These findings establish a platform for advancing the science of allorecognition.