The muscles of the anterior compartment of the lower leg are generally responsible for dorsiflexion. The muscles of the posterior compartment of the lower leg are generally responsible for plantar flexion. The lateral and medial muscles in both compartments invert, evert, and rotate the foot.