The mechanism by which a liquid may become arrested, forming a glass or gel, is a long-standing problem of materials science. In particular, long-lived (energetically) locally favoured structures (LFSs), the geometry of which may prevent the system relaxing to its equilibrium state, have long been thought to play a key role in dynamical arrest. Here, we propose a definition of LFSs which we identify with a novel topological method and directly measure with experiments on a colloidal liquid-gel transition. The population of LFSs is a strong function of (effective) temperature in the ergodic liquid phase, rising sharply approaching dynamical arrest, and indeed forms a percolating network that becomes the 'arms' of the gel. Owing to the LFSs, the gel is unable to reach equilibrium, crystal-gas coexistence. Our results provide direct experimental observation of a link between local structure and dynamical arrest, and open a new perspective on a wide range of metastable materials.