A defining characteristic of the immune system is the constant movement of many of its constituent cells through the secondary lymphoid tissues, mainly the spleen and lymph nodes, where crucial interactions that underlie homeostatic regulation, peripheral tolerance and the effective development of adaptive immune responses take place. What has only recently been recognized is the role that non-haematopoietic stromal elements have in many aspects of immune cell migration, activation and survival. In this Review, we summarize our current understanding of lymphoid compartment stromal cells, examine their possible heterogeneity, discuss how these cells contribute to immune homeostasis and the efficient initiation of adaptive immune responses, and highlight how targeting of these elements by some pathogens can influence the host immune response.