In natural conditions, basidiomycete ectomycorrhizal fungi such as Laccaria bicolor are typically in the dikaryotic state when forming symbioses with trees, meaning that two genetically different individuals have to fuse or 'mate'. Nevertheless, nothing is known about the molecular mechanisms of mating in these ecologically important fungi. Here, advantage was taken of the first sequenced genome of the ectomycorrhizal fungus, Laccaria bicolor, to determine the genes that govern the establishment of cell-type identity and orchestrate mating. The L. bicolor mating type loci were identified through genomic screening. The evolutionary history of the genomic regions that contained them was determined by genome-wide comparison of L. bicolor sequences with those of known tetrapolar and bipolar basidiomycete species, and by phylogenetic reconstruction of gene family history. It is shown that the genes of the two mating type loci, A and B, are conserved across the Agaricales, but they are contained in regions of the genome with different evolutionary histories. The A locus is in a region where the gene order is under strong selection across the Agaricales. By contrast, the B locus is in a region where the gene order is likely under a low selection pressure but where gene duplication, translocation and transposon insertion are frequent.