Immunocastration is an alternative method to replace surgical castration that is commonly performed in domestic and pet animals. In this study, a new immunocastration vaccine was developed, and its efficacy was evaluated in male rats. Six tandem copies of gonadotrophin-releasing hormone (GnRH) peptide were genetically fused to Salmonella typhimurium flagellin fljB (STF2) that is a ligand of toll-like receptor 5 (TLR5). The recombinant STF2–GnRH protein expressed in Escherichia coli was used as the immunocastration vaccine. Sixteen male rats were equally assigned to four groups. Excluding the control rats, three groups were immunized with 100, 200 and 400 μg of the STF2–GnRH vaccine, respectively. All of the immunized rats developed significantly higher titres of antibodies to GnRH than the control rats. The size and weight of both testes and epididymides from the immunized rats were significantly smaller than those of the control rats. Testicular tissues in the immunized rats demonstrated atrophy of seminiferous tubules and decreased numbers of both spermatogonia and spermatocytes. These data indicate that the newly developed STF2–GnRH vaccine has a potent immunogenicity to GnRH and efficiently suppresses the development of testes in rats.