Neuroprosthetics offer great hope for motor-impaired human patients. One obstacle is that fine motor control requires near instantaneous, rich somatosensory feedback. Such distributed touch feedback may be recreated in a brain-machine interface using distributed artificial stimulation across the primary somatosensory cortex surface. Here, we hypothesized that this neuronal stimulation must be contiguous in its spatial organization and temporal dynamics in order to be efficiently integrated by sensorimotor circuits. Using a closed-loop brain-machine interface, we trained head-fixed mice to control a virtual cursor by modulating the activity of motor cortex neurons. We provided artificial feedback in real time, consisting of distributed optogenetic stimulation patterns in the primary somatosensory cortex. We found that the mice only developed a specific motor strategy and sustained task performance when the optogenetic feedback pattern was contiguous while it moved across the topography of the somatosensory cortex. These results reveal new properties of cortical integration, and set new constraints on the design of neuroprosthetics.