1. Bauer, S. & Hoye, B. J. Migratory animals couple biodiversity and ecosystem functioning worldwide. Science 344, 1242552 (2014).

2. Pecl, G. T. et al. Biodiversity redistribution under climate change: impacts on ecosystems and human well-being. Science 355, eaai9214 (2017).

3. Helmus, M. R., Mahler, D. L. & Losos, J. B. Island biogeography of the Anthropocene. Nature 513, 543–546 (2014).

4. Sax, D. F. et al. Ecological and evolutionary insights from species invasions. Trends Ecol. Evol. 22, 465–471 (2007).

5. Torchin, M. E., Lafferty, K. D., Dobson, A. P., McKenzie, V. J. & Kuris, A. M. Introduced species and their missing parasites. Nature 421, 628–630 (2003).

6. Altizer, S., Bartel, R. & Han, B. A. Animal migration and infectious disease risk. Science 331, 296–302 (2011).

7. Mitchell, C. E. & Power, A. G. Release of invasive plants from fungal and viral pathogens. Nature 421, 625–627 (2003).

8. Westerdahl, H. et al. in Animal Movement Across Scales (eds Hansson, L. A. & Åkesson, S.) Ch. 8 (Oxford Univ. Press, Oxford, 2014).

9. Keane, R. M. & Crawley, M. J. Exotic plant invasions and the enemy release hypothesis. Trends Ecol. Evol. 17, 164–170 (2002).

10. Almberg, E. S., Cross, P. C., Dobson, A. P., Smith, D. W. & Hudson, P. J. Parasite invasion following host reintroduction: a case study of Yellowstone’s wolves. Philos. Trans. R. Soc. Lond. B Biol. Sci. 367, 2840–2851 (2012).

11. Guégan, J.-F., Prugnolle, F. & Thomas, F. in Evolution in Health and Disease (eds Stearns, S. C. & Koella, J. C.) Ch. 2 (Oxford Univ. Press, Oxford, 2008).

12. Guernier, V., Hochberg, M. E. & Guégan, J.-F. Ecology drives the worldwide distribution of human diseases. PLoS Biol. 2, e141 (2004).

13. Bordes, B., Guégan, J. F. & Morand, S. Microparasite species richness in rodents is higher at lower latitudes and is associated with reduced litter size. Oikos 120, 1889–1896 (2011).

14. Nunn, C. L., Altizer, S. M., Sechrest, W. & Cunningham, A. A. Latitudinal gradients of parasite species richness in primates. Divers. Distrib. 11, 249–256 (2005).

15. Yang, X. B. & Feng, F. Ranges and diversity of soybean fungal diseases in North America. Phytopathology 91, 769–775 (2001).

16. Rohde, K. Ecology and biogeography of marine parasites. Adv. Mar. Biol. 43, 1–83 (2002).

17. Wellman, F. L. More diseases on crops in the tropics than in the temperate zone. Ceíba 14, 17–28 (1968).

18. Clark, N. J., Clegg, S. M. & Klaassen, M. Migration strategy and pathogen risk: non‐breeding distribution drives malaria prevalence in migratory waders. Oikos 125, 1358–1368 (2016).

19. Mendes, L., Piersma, T., Lecoq, M., Spaans, B. & Ricklefs, R. E. Disease‐limited distributions? Contrasts in the prevalence of avian malaria in shorebird species using marine and freshwater habitats. Oikos 109, 396–404 (2005).

20. Merino, S. et al. Haematozoa in forest birds from southern Chile: latitudinal gradients in prevalence and parasite lineage richness. Austral Ecol. 33, 329–340 (2008).

21. Lenz, T. L. Computational prediction of MHC II–antigen binding supports divergent allele advantage and explains trans-species polymorphism. Evolution 65, 2380–2390 (2011).

22. Murphy, K., Janeway C. A. Jr., Travers, P., Walport, M. & Ehrenstein, M. Janeway’s Immunobiology 7th edn (Garland Science, New York, 2008).

23. Hughes, A. L. & Hughes, M. A. K. Coding sequence polymorphism in avian mitochondrial genomes reflects population histories. Mol. Ecol. 16, 1369–1376 (2007).

24. Aguilar, A. et al. High MHC diversity maintained by balancing selection in an otherwise genetically monomorphic mammal. Proc. Natl Acad. Sci. USA 101, 3490–3494 (2004).

25. Schierup, M. H., Vekemans, X. & Charlesworth, D. The effect of subdivision on variation at multi-allelic loci under balancing selection. Genet. Res. 76, 51–62 (2000).

26. Van Oosterhout, C. et al. Balancing selection, random genetic drift, and genetic variation at the major histocompatibility complex in two wild populations of guppies (Poecilia reticulata). Evolution 60, 2562–2574 (2006).

27. Sorci, G. Immunity, resistance and tolerance in bird–parasite interactions. Parasite Immunol. 35, 350–361 (2013).

28. Eizaguirre, C., Lenz, T. L., Kalbe, M. & Milinski, M. Rapid and adaptive evolution of MHC genes under parasite selection in experimental vertebrate populations. Nat. Comm. 3, 621 (2012).

29. Piertney, S. B. & Oliver, M. K. The evolutionary ecology of the major histocompatibility complex. Heredity 96, 7–21 (2006).

30. Edwards, S. V. & Hedrick, P. W. Evolution and ecology of MHC molecules: from genomics to sexual selection. Trends Ecol. Evol. 13, 305–311 (1998).

31. Yang, Z. PAML 4: phylogenetic analysis by maximum likelihood. Mol. Biol. Evol. 24, 1586–1591 (2007).

32. Kiepiela, P. et al. Dominant influence of HLA-B in mediating the potential co-evolution of HIV and HLA. Nature 432, 769–775 (2004).

33. McKiernan, S. M. et al. Distinct MHC class I and II alleles are associated with hepatitis C viral clearance, originating from a single source. Hepatology 40, 108–114 (2004).

34. Wallny, H. J. et al. Peptide motifs of the single dominantly expressed class I molecule explain the striking MHC-determined response to Rous sarcoma virus in chickens. Proc. Natl Acad. Sci. USA 103, 1434–1439 (2006).

35. Hellgren, O. et al. Detecting shifts of transmission areas in avian blood parasites—a phylogenetic approach. Mol. Ecol. 16, 1281–1290 (2007).

36. Piersma, T. Do global patterns of habitat use and migration strategies co-evolve with relative investments in immunocompetence due to spatial variation in parasite pressure? Oikos 80, 623–631 (1997).

37. Westerdahl, H., Wittzell, H. & von Schantz, T. Mhc diversity in two passerine birds: no evidence for a minimal essential Mhc. Immunogenetics 52, 92–100 (2000).

38. Abbas, A. K., Lichtman, A. H. & Pillai, S. Basic Immunology: Functions and Disorders of the Immune System 4th edn (Elsevier Saunders, Philadelphia, 2014).

39. Wegner, K. M., Kalbe, M., Kurtz, J., Reusch, T. B. H. & Milinski, M. Parasite selection for immunogenetic optimality. Science 301, 1343 (2003).

40. Jetz, W., Thomas, G. H., Joy, J. B., Hartmann, K. & Mooers, A. O. The global diversity of birds in space and time. Nature 491, 444–448 (2012).

41. Buehler, D. & Piersma, T. Travelling on a budget: predictions and ecological evidence for bottlenecks in the annual cycle of long-distance migrants. Philos. Trans. R. Soc. B 363, 247–266 (2008).

42. Hasselquist, D. Comparative immunoecology in birds: hypotheses and tests. J. Ornithol. 148, 571–582 (2007).

43. Yohannes, E. et al. Isotope signatures in winter moulted feathers predict malaria prevalence in a breeding avian host. Oecologia 158, 299–306 (2008).

44. Winger, B. M., Barker, F. K. & Ree, R. H. Temperate origins of long-distance seasonal migration in New World songbirds. Proc. Natl Acad. Sci. USA 111, 12115–12120 (2014).

45. Harvell, C. D. et al. Climate warming and disease risks for terrestrial and marine biota. Science 296, 2158–2162 (2002).

46. Altizer, S., Ostfeld, R. S., Johnson, P. T., Kutz, S. & Harvell, C. D. Climate change and infectious diseases: from evidence to a predictive framework. Science 341, 514–519 (2013).

47. Gill, F. & Donsker, D. IOC World Bird List Version 6.2 (International Ornithological Congress, 2016); https://doi.org/10.14344/IOC.ML.6.2

48. Del Hoyo, J., Elliott, A., Sargatal, J., Christie, D. A. & de Juana E. Handbook of the Birds of the World Alive (Lynx Edicions, Barcelona, 2016).

49. Hackett, S. J. et al. A phylogenomic study of birds reveals their evolutionary history. Science 320, 1763–1768 (2008).

50. Pagel, M. A. & Meade, A. Bayesian analysis of correlated evolution of discrete characters by reversible‐jump Markov chain Monte Carlo. Am. Nat. 167, 808–825 (2006).

51. Bollback, J. P. SIMMAP: stochastic character mapping of discrete traits on phylogenies. BMC Bioinforma. 7, 88 (2006).

52. Revell, L. J. Phytools: an R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol. 3, 217–223 (2012).

53. Plummer, M., Best, N., Cowles, K. & Vines, K. CODA: convergence diagnosis and output analysis for MCMC. R. News 6, 7–11 (2006).

54. Gelman, A. & Rubin, D. B. Inference from iterative simulation using multiple sequences. Stat. Sci. 7, 457–511 (1992).

55. Hadfield, J. MCMC methods for multi-response generalised linear mixed models: the MCMCglmm R package. J. Stat. Softw. 33, 1–22 (2010).

56. de Villemereuil, V., Gimenez, O. & Doligez, B. Comparing parent–offspring regression with frequentist and Bayesian animal models to estimate heritability in wild populations: a simulation study for Gaussian and binary traits. Methods Ecol. Evol. 4, 260–275 (2013).

57. Minias, P., Whittingham, L. A. & Dunn, P. O. Coloniality and migration are related to selection on MHC genes in birds. Evolution 71, 432–441 (2017).

58. Bird Species Distribution Maps of the World Version 5.0. (BirdLife International & NatureServe, 2015).

59. Barker, F. K., Cibois, A., Schikler, P., Feinstein, J. & Cracraft, J. Phylogeny and diversification of the largest avian radiation. Proc. Natl Acad. Sci. USA 101, 11040–11045 (2004).

60. O’Connor, E. A., Strandh, M., Hasselquist, D., Nilsson, J. Å. & Westerdahl, H. The evolution of highly variable immunity genes across a passerine bird radiation. Mol. Ecol. 25, 977–989 (2016).

61. Sebastian, A., Herdegen, M., Migalska, M. & Radwan, J. AmpliSAS: a web server for multilocus genotyping using next-generation amplicon sequencing data. Mol. Ecol. Res. 16, 498–510 (2016).

62. Peaper, D. R. & Cresswell, P. Regulation of MHC class I assembly and peptide binding. Annu. Rev. Cell Dev. Biol. 24, 343–368 (2008).

63. Bjorkman, P. et al. The foreign antigen binding site and T cell recognition regions. Nature 329, 512–518 (1987).

64. Tamura, T., Stecher, G., Peterson, D., Filipski, A. & Kumar, S. MEGA6: molecular evolutionary genetics analysis version 6.0. Mol. Biol. Evol. 30, 2725–2729 (2013).

65. Gil, M., Zanetti, M. S., Zoller, S. & Anisimova, M. CodonPhyML: fast maximum likelihood phylogeny estimation under codon substitution models. Mol. Biol. Evol. 30, 1270–1280 (2013).

66. Yang, Z., Wong, W. S. & Nielsen, R. Bayes empirical Bayes inference of amino acid sites under positive selection. Mol. Biol. Evol. 22, 1107–1118 (2005).

67. Wilson, D. J. & McVean, G. Estimating diversifying selection and functional constraint in the presence of recombination. Genetics 172, 1411–1425 (2006).

68. Hartl, D. L. & Clark, A. G. Principles of Population Genetics (Sinauer Associates, Sunderland, 1998).

69. Carnaval, A. C., Hickerson, M. J., Haddad, C. F., Rodrigues, M. T. & Moritz, C. Stability predicts genetic diversity in the Brazilian Atlantic forest hotspot. Science 323, 785–789 (2009).

70. Lanfear, R., Ho, S. Y., Love, D. & Bromham, L. Mutation rate is linked to diversification in birds. Proc. Natl Acad. Sci. USA 107, 20423–20428 (2010).

71. Garamszegi, L. Z. Modern Phylogenetic Comparative Methods and Their Application in Evolutionary Biology (Springer, Berlin, 2014).

72. Brown, J. H. in Macroecology Ch. 5 (Univ. Chicago Press, Chicago, 1995).

73. Blueweiss, L., Fox, H., Kudzma, V., Nakashima, D., Peters, R. & Sams, S. Relationships between body size and some life history parameters. Oecologia 37, 257–272 (1978).

74. Nunn, C. L., Altizer, S., Jones, K. E. & Sechrest, W. Comparative tests of parasite species richness in primates. Am. Nat. 162, 597–614 (2003).