How does the brain control movement? Experiments suggest that the (pre-)motor cortex behaves like an “engine” whose dynamics drive movement, and whose activity must first be initialised into movement-specific states (“the optimal subspace hypothesis”, Shenoy et al, 2013). Both the computational and mechanistic underpinnings of this preparatory process remain poorly understood. Here, we propose a circuit model for movement preparation and execution. We formalise movement preparation as an optimal control problem, under an internal forward model that predicts (future) patterns of muscle activity from momentary cortical preparatory states. We compute the preparatory input to cortex that drives fastest convergence to preparatory states predicted to yield the correct motor outputs. Critically, we show that optimal control inputs can be realised via feedback in realistic, thalamo-cortical neural circuit architectures, and that multiple control loops can be flexibly combined to generate movements composed of a few movement primitives. The model produces naturalistic patterns of preparatory activity, and accounts for across-trial variability suppression as well as orthogonality between preparatory and movement-related activity subspaces.