Ecological communities are assembled and sustained by colonisation. At the same time, predators make foraging decisions based on the local availabilities of potential resources, which reflects colonisation. We combined field and laboratory experiments with mathematical models to demonstrate that a feedback between these two processes determines emergent patterns in community structure. Namely, our results show that prey colonisation rate determines the strength of trophic cascades - a feature of virtually all ecosystems - by prompting behavioural shifts in adaptively foraging omnivorous fish predators. Communities experiencing higher colonisation rates were characterised by higher invertebrate prey and lower producer biomasses. Consequently, fish functioned as predators when colonisation rate was high, but as herbivores when colonisation rate was low. Human land use is changing habitat connectivity worldwide. A deeper quantitative understanding of how spatial processes modify individual behaviour, and how this scales to the community level, will be required to predict ecosystem responses to these changes.