Alignment of joints with respect to the leg axis reduces the moment arm of external forces and therefore joint torques. Moreover, it affects the gearing of muscle forces and displacements. Thus, it influences tissue stress, cost of support and locomotion, and stability. Assuming that alignment is of general advantage we propose a mathematical criterion quantifying the axial alignment using the static torque equilibrium of a three-segment leg. Using this criterion derived from joint torque minimisation we asked for optimal leg designs (segment lengths and joint angles) at varied leg lengths. The trivial "straight is best" solution is excluded and the configuration space is restricted by geometrical constraints such as the ground contact. For different total leg lengths we could identify different optimal segment length combinations and appropriately adjusted joint angles. The extended human leg configuration characterised by a short foot and a combination of unequal ankle and knee angles emerges as a global optimum from our analysis. For crouched configurations allowing for larger leg extensions an angle symmetrical 1:1:1 segment length combination is best. The plantigrade optimum is enforced by the requirement of the distal segment (foot) being shorter than the opposite outer segment (thigh), as well as by the ground contact constraint. Different (e.g. digitigrade) geometries might be of advantage in different biological contexts with different constraints. The fact that small mammals use a crouched equal segment design implies that other locomotor requirements such as stability, strain rates, and acceleration distance per step might dominate.