Sexual selection results in sex-specific characters like the conspicuously pigmented extension of the ventral tip of the caudal fin - the 'sword' - in males of several species of Xiphophorus fishes. To uncover the genetic architecture underlying sword formation and to identify genes that are associated with its development, we characterized the sword transcriptional profile and combined it with genetic mapping approaches. Results showed that the male ornament of swordtails develops from a sexually non-dimorphic prepattern of transcription factors in the caudal fin. Among genes that constitute the exclusive sword transcriptome and are located in the genomic region associated with this trait we identify the potassium channel, Kcnh8, as a sword development gene. In addition to its neural function kcnh8 performs a known role infin growth. These findings indicates that during evolution of swordtails a brain gene has been co-opted for an additional novel function in establishing a male ornament.