The prefrontal cortex (PFC) is thought to participate in high-level control of the generation of behaviours (including the decision to execute actions); indeed, imaging and lesion studies in human beings have revealed that PFC dysfunction can lead to either impulsive states with increased tendency to initiate action, or to amotivational states characterized by symptoms such as reduced activity, hopelessness and depressed mood. Considering the opposite valence of these two phenotypes as well as the broad complexity of other tasks attributed to PFC, we sought to elucidate the PFC circuitry that favours effortful behavioural responses to challenging situations. Here we develop and use a quantitative method for the continuous assessment and control of active response to a behavioural challenge, synchronized with single-unit electrophysiology and optogenetics in freely moving rats. In recording from the medial PFC (mPFC), we observed that many neurons were not simply movement-related in their spike-firing patterns but instead were selectively modulated from moment to moment, according to the animal's decision to act in a challenging situation. Surprisingly, we next found that direct activation of principal neurons in the mPFC had no detectable causal effect on this behaviour. We tested whether this behaviour could be causally mediated by only a subclass of mPFC cells defined by specific downstream wiring. Indeed, by leveraging optogenetic projection-targeting to control cells with specific efferent wiring patterns, we found that selective activation of those mPFC cells projecting to the brainstem dorsal raphe nucleus (DRN), a serotonergic nucleus implicated in major depressive disorder, induced a profound, rapid and reversible effect on selection of the active behavioural state. These results may be of importance in understanding the neural circuitry underlying normal and pathological patterns of action selection and motivation in behaviour.