Flexible territorial structures are common to a variety of animal populations. When resources are abundant, animals can maintain relatively fixed territory boundaries. However, if resources decline, animals may have to intrude temporarily into a neighbour's territory to secure enough food for survival. Although such intrusions may be necessary, they take time away from foraging and can lead to costly conflicts, resulting in a behavioural trade-off. Here, we examine this trade-off using a spatially explicit, energy-based movement model inspired by observations of giant otters. We uncover conditions under which temporary neighbour intrusions are beneficial. We show that, under certain circumstances, this benefit is sufficient for allowing territorial groups to survive in perpetuity, when otherwise they would be forced to disperse or die. Our model also reveals plausible mechanisms behind a variety of observed phenomena, including the emergence of intermediate-sized territorial groups, territorial fission/fusion dynamics, and the employment of multiple methods for advertising territories (e.g. vocal and olfactory). Although we focus our modelling on giant otters, the behavioural mechanisms it describes are quite general, having been observed across a wide range of taxa, including birds, fish and mammals. Our model therefore serves as a general theoretical test-bed for understanding temporary territory expansion.