Objective. Nerves in the peripheral nervous system (PNS) contain axons with specific motor, somatosensory and autonomic functions. Optogenetics offers an efficient approach to selectively activate axons within the nerve. However, the heterogeneous nature of nerves and their tortuous route through the body create a challenging environment to reliably implant a light delivery interface. Approach. Here, we propose an optical peripheral nerve interface—an optocuff—, so that optogenetic modulation of peripheral nerves become possible in freely behaving mice. Main results. Using this optocuff, we demonstrate orderly recruitment of motor units with epineural optical stimulation of genetically targeted sciatic nerve axons, both in anaesthetized and in awake, freely behaving animals. Behavioural experiments and histology show the optocuff does not damage the nerve thus is suitable for long-term experiments. Significance. These results suggest that the soft optocuff might be a straightforward and efficient tool to support more extensive study of the PNS using optogenetics.