Organisms that exploit different environments may experience a stochastic delay in adjusting their fitness when they switch habitats. We study two such organisms whose fitness is determined by the species composition of the local environment, as they interact through a public good. We show that a delay in fitness adjustment can lead to coexistence of the two species in a metapopulation, although the faster growing species always wins in well-mixed competition experiments. Coexistence is favored over wide parameter ranges, and is independent of spatial clustering. It arises when species are heterogeneous in their fitness and can keep each other balanced.How biodiversity -for example, the surprising coexistence of more than 10 000 species in a single gram of soil [1-3] -is stabilised is one of the most fundamental questions in ecology [4]. Known stabilising factors derived from resource competition models include metabolic trade-offs [5] and reciprocal oscillations in population sizes [6]. Cyclic competition models and their derivatives are also frequently employed to model biodiversity [7][8][9]. However, recent experiments on a variety of different soil species in well-mixed pair-wise competition experiments found that these species could not be represented by cyclic competition models; instead, a few species outcompeted the others [10]. Thus, microbial diversity in soil is thought to be supported by the highly porous and fragmented structure of this habitat [11], and the fluctuating environmental conditions that individual bacteria experience there [10].Here, we ask how the influence of spatial structure, characterized by intrinsic variation between local environments, and the delayed adjustment to changes of these environments, can affect the long-term behaviour of species in a simple model system. Indeed, it is wellknown that such delays in physiological responses (here, adjustment of fitness or growth rate) occur in microbes, following externally imposed changes in the environment [12][13][14][15], such as nutrient composition, or antibiotic stress [16][17][18][19][20][21][22]. Here, we focus on changes that occur because species move between different habitats. We consider a system with two species, in which the dominant strain (fast grower) depends on the slower growing strain for its fitness. Thus, the fitness of both species depends on the intrinsic population structure of the local habitat. We assume that the fitness of an individual is not instantaneously reset when the environment changes, but is initially retained from its previous environment, as we discuss below.We show that coexistence can arise in such a minimal two-species model, as a result of delays in fitness adjustment after a change of local habitat, and nonlinearity of fitness functions. In particular, we conclude that the combination of underlying spatial structure -not spa-