We sought to develop a theoretical framework for understanding how different cortical areas are recruited in an orderly pattern following strokes of varying severity. In line with the theory of optimal control in arm movements, we propose that the brain maximizes motor performance despite anatomical constraints imposed by a lesion. This optimization is achieved through a reinforcement learning process in cortical neurons, which maximizes performance as a function of motor error and effort, and a homeostatic regulation process in spinal motor neurons, which facilitates information transfer. We simulated an isometric arm task with a 7-muscle planar arm controlled by a cortical network comprising three regions-primary motor (M1), premotor (PM), and contralesional motor cortex (CM1)-and spinal motor neurons (MNs). We simulated three lesion sizes: small (50% M1 lesion), medium (100% M1 lesion), and large (100% M1 and PM lesion). The model demonstrated systematic recruitment of the remaining regions, mirroring experimental observations. Key findings include the role of PM in the recovery of fine motor control; for large lesions, the role of CM1 in preventing paralysis and generating abnormal synergies; and the role of homeoplasticity in motor neurons to enable force generation. Compensatory activity in PM and CM1 was more prominent in early than late recovery as the network minimized effort. These simulations indicate that the recruitment of compensatory areas following strokes of increasing size results from local plastic processes that maximize performance. Furthermore, our model makes testable predictions, including a plausible crucial role for dopamine in motor cortical reorganization post-stroke.