Food webs are highly complex ecological networks, dynamic in both space and time. Metacommunity models are now at the core of unified theories of biodiversity, but to date they have not addressed food web complexity. Here we show that metacommunity theory can explain the emergence of species-rich food webs with complex network topologies. Our analysis shows that network branching in the food web is maximized at intermediate colonization rates and limited dispersal scales, which also leads to concomitant peaks in species diversity. Increased food web complexity and species diversity are made possible by the structural role played by network branches that are supported by omnivore and generalist feeding links. Thus, in contrast to traditional food web theory, which emphasizes the destabilizing effect of omnivory feeding in closed systems, metacommunity theory predicts that these feeding links, which are commonly observed in empirical food webs, play a critical structural role as food webs assemble in space. As this mechanism functions at the metacommunity level, evidence for its operation in nature will be obtained through multiscale surveys of food web structure. Finally, we apply our theory to reveal the effects of habitat destruction on network complexity and metacommunity diversity.spatial ecology | patch-dynamic models T he science of networks is deepening our understanding of biodiversity in complex ecosystems (1). Food webs are archetypal ecological networks that have important temporal and spatial dimensions crucial to their assembly and persistence (2). Spatial food web data reveal patterns of species interactions that are structured in space, and theory suggests that this spatial structure may underlie a general explanation of food web complexity (3-7). Recently metacommunity theory has successfully invoked spatial processes such as dispersal to explain patterns of biological diversity from local to regional scales (8-11). However, to date metacommunity theory has focused on communities structured by competitive interactions, and although attempts have been made to extend the approach to the study of simple trophic interactions (12, 13), the study of larger, more complex trophic networks has largely remained-with rare exceptions (14, 15)-outside its purview (2).The need for a general spatial theory of food webs is acute given current rates of biodiversity loss under global environmental change. Habitat destruction and fragmentation are changing not only species richness, but also the diversity and patterns of species interactions that link them in networks (16). Over time food webs disassemble in nonrandom patterns as the spatial network of interconnected patches of habitat is altered, eroded, and isolated (17). Shifts in food web interactions arising from spatial habitat compression also perturb the ecosystem functions at local and metacommunity scales (18). Efforts to restore functional food webs in fragmented landscapes will require an explicit theory of how food webs assemble and disassemble in space...