Mark A. W. Andrews, associate professor of physiology and associate director of the Independent Study program at the Lake Erie College of Osteopathic Medicine, provides the following explanation:

Muscle cramping is a common problem encountered by athletes and nonathletes alike. Defined as painful involuntary skeletal muscle contractions, cramps may be categorized as either nonexercise related or exercise related. The etiology of the former group may involve hormonal, electrolyte or metabolic imbalances, or it may result from long-term medication. Diagnostic medical testing may be required if cramps are a persistent problem. Exercise-related muscle cramps (ERMC) are much more common. They typically affect the large muscles of the legs during or immediately after exercise and last for seconds to a few minutes. These are typically benign but result in intense pain and may not seem innocuous at the time.

There is little definitive knowledge of the etiology of ERMC. Traditionally, such cramping was believed to arise from dehydration, electrolyte imbalances (including magnesium, potassium and sodium), accumulation of lactic acid, or low cellular energy levels. These proposals, however, have been shown to have minimal scientific value. More recent developments indicate that the cause of cramps most likely involves hyperactivity of the nerve-muscle reflex arc. In this scheme, some of the normal inhibitory activity of the central nervous system (CNS) reflexes is lost as a result of CNS fatigue or overuse of feedback communication with muscles. These spinal reflexes use two receptors, known as Golgi tendon organs and muscles spindles, found in skeletal muscles. Golgi tendon organs may become inhibited and muscles spindles can become hyperactive, leading to sustained activation of the muscle. It has been suggested that prolonged sitting, poor or abnormal posture or inefficient biomechanics (all of which may be related to poor flexibility) predispose these reflexes to malfunctioning. Age also seems to predispose individuals to cramping--the phenomenon may develop later in life for people who exercise for years without prior problems. Other factors include increased body weight and improper footwear. Eccentric muscle contraction and other musculoskeletal injuries can contribute to the problem.

If a muscle's hyperexcitability is the basis of cramping, then stretching should attenuate the response. In evidence, it is well recognized that, once induced, stretching the affected muscle can ameliorate cramping. Stretches should be held for 15 to 30 seconds or until the muscle relaxes and the cramp does not recur when the muscle is returned to its normal relaxed position. In addition, once cramping starts, exercise should be curtailed for at least an hour, which allows the muscles and the CNS to recover. It is never a good idea to "run through" these cramps. Applying heat to the area for a few minutes while stretching may also help the muscle.

Prophylactic stretching of the major muscles of the lower limbs for at least five to 10 minutes during warm-up and cool-down periods can help prevent cramps. The importance of flexibility cannot be overstated, particularly for older athletes. Other recommendations include minimizing running hills and stairs (limiting eccentric contractions); undergoing a biomechanical evaluation of your exercise technique; making sure shoes and other equipment are appropriate and not excessively worn. If, after a few months, cramps do not respond to these measures, see a qualified sports physician or physical therapist.