Habitat destruction and human activity have greatly impacted the natural history of the giant panda (Ailuropoda melanoleuca). Although the genetic diversity of neutral markers has been examined in this endangered species, no previous work has examined adaptive molecular polymorphisms in the giant panda. Here, the major histocompatibility complex (MHC) class II DRB locus was investigated in the giant panda, using single-strand conformation polymorphism (SSCP) and sequence analysis. Comparisons of DNA samples extracted from faecal and blood samples from the same individual revealed that the two materials yielded similar quantities and qualities of DNA, as well as identical SSCP patterns and allelic sequences, demonstrating the reliability of DNA isolation from panda faeces. Analysis of faecal samples from 60 giant pandas revealed relatively low number of alleles: seven alleles. However, the alleles were quite divergent, varying from each other by a range of 7–47 nucleotide substitutions (4–25 amino acid substitutions). Construction of a neighbour-joining tree and comparisons among DRB alleles from other species revealed that both similar and highly divergent alleles survived in the bottlenecked panda populations. Despite species-specific primers used and excellent faecal DNA isolated, a lower level of heterozygosity than expected was still observed due to inbreeding. There were three types of evidence supporting the presence of balancing selection in the giant panda: (i) an obvious excess of nonsynonymous substitutions over synonymous at the antigen-binding positions; (ii) trans-species evolution of two alleles between the giant panda and other felids; and (iii) a more even distribution of alleles than expected from neutrality.