You could be out for a run or drifting off to sleep when it happens: The muscles of your calf or foot suddenly become hard, tight, and extremely painful. You are having a muscle cramp. Sometimes called charley horses -- particularly when they are in the calf muscles -- cramps are caused by muscle spasms, involuntary contractions of one or more muscles. In addition to the foot and calf muscles, other muscles prone to spasms include the front and back of the thigh, the hands, arms, abdomen, and muscles along the rib cage. Almost everyone experiences muscle cramps, which come without warning. What causes them, and what can you do to relieve them? Possible Causes of Muscle Cramps Muscle cramps can have many possible causes. They include:

Poor blood circulation in the legs

Overexertion of the calf muscles while exercising

Insufficient stretching before exercise

Exercising in the heat

Muscle fatigue

Dehydration

Magnesium and/or potassium deficiency

Calcium deficiency in pregnant women

Malfunctioning nerves, which could be caused by a problem such as a spinal cord injury or pinched nerve in the neck or back.

Muscle cramps can also occur as a side effect of some drugs. Medications that can cause muscle cramps include:

Lasix (furosemide), Microzide (hydrochlorothiazide), and other diuretics ("water pills") used to remove fluid from the body

Treatment of a Muscle Spasm When muscle cramps occur, there are several things you can do to help ease them, such as massaging, stretching, or icing the muscle, warming the muscle, or taking a bath with Epsom salt. For a charley horse in the calf or a cramp in the back of the thigh (hamstring), try putting your weight on the affected leg and bending your knee slightly, or sit or lie down with your leg out straight and pull the top of your foot toward your head. For a cramp in the front of the thigh (quadriceps), hold onto a chair to steady yourself and pull your foot back toward your buttock. To help reduce the risk of cramps in the future, try the following:

In most cases, self-care measures are sufficient for dealing with muscle cramps, which typically go away within minutes. But if you experience them frequently or for no apparent reason, you should speak to your doctor. They could signal a medical problem that requires treatment.