Inferring the role of interactions in territorial animals relies upon accurate recordings of the behaviour of neighbouring individuals. Such accurate recordings are rarely available from field studies. As a result, quantification of the interaction mechanisms has often relied upon theoretical approaches, which hitherto have been limited to comparisons of macroscopic population-level predictions from un-tested interaction models. Here we present a quantitative framework that possesses a microscopic testable hypothesis on the mechanism of conspecific avoidance mediated by olfactory signals in the form of scent marks. We find that the key parameters controlling territoriality are two: the average territory size, i.e. the inverse of the population density, and the time span during which animal scent marks remain active. Since permanent monitoring of a territorial border is not possible, scent marks need to function in the temporary absence of the resident. As chemical signals carried by the scent only last a finite amount of time, each animal needs to revisit territorial boundaries frequently and refresh its own scent marks in order to deter possible intruders. The size of the territory an animal can maintain is thus proportional to the time necessary for an animal to move between its own territorial boundaries. By using an agent-based model to take into account the possible spatio-temporal movement trajectories of individual animals, we show that the emerging territories are the result of a form of collective animal movement where, different to shoaling, flocking or herding, interactions are highly heterogeneous in space and time. The applicability of our hypothesis has been tested with a prototypical territorial animal, the red fox (Vulpes vulpes).