I’ve sometimes woken in the middle of the night with leg cramps severe enough to propel me to the floor faster than an alarm clock ever could. The first time was when I was pregnant. The other times, a new exercise routine or arduous hike left me doubled over with leg cramps. It turns out pregnancy, exercise and increasing age all put me at higher risk for this excruciatingly painful event.

And I have lots of company. Some 50 to 60 percent of adults experience night leg cramps or “charley horses,” and one in five people find them so onerous that they seek medical help, according to an article on nocturnal leg cramps in American Family Physician.

Related: Spider Veins: Should You Get Them Zapped or Injected?

When leg cramps are a warning

Leg cramps occur when a muscle in the calf, thigh or foot spasms, aches or tightens up, usually from over-exertion, experts say. While most of these cramps are short-lived and no reason for concern, Richard E. Allen, MD, of St Mark’s Family Medicine Residency in Salt Lake City, points out that if leg cramps persist, you should see your doctor to rule out a more serious condition.

Allen, who co-wrote the American Family Physician article, says “if a patient comes in and smokes, has a family history of heart disease or high cholesterol and hasn’t been exercising, I’m more likely to suspect something like vascular disease.”

Here are some diseases and conditions that your leg cramps may be trying to tell you about.

Peripheral artery disease, or PAD. PAD is caused by narrowing of the arteries in your legs. As a result, your legs don’t get enough blood to keep up with the demands of your body. You may experience this as leg pain, tingling and numbness mixed with occasional cramps.

Diabetes and Parkinson’s disease. Nerve pain and cramps can result from Type 1 or Type 2 diabetes or Parkinson’s disease. Allen says that if the drug gabapentin eases the pain, the problem is likely originating in the nerves, although that does not automatically mean you have diabetes. “Frankly, I often find it is a matter of trial and error,” says Allen. “If calcium channel blockers help relieve the muscle pain, I would want to screen for peripheral artery disease.”

Related: Warning: You Might Have Diabetes and Not Know It

Vascular disease. If you have persistent leg cramps, your doctor may want to rule out vascular (vein) disease or venous insufficiency, which occurs when the veins can’t pump enough blood back to the heart.

Heat exhaustion. If you’ve been exercising on a hot day, leg cramps are a sign of heat exhaustion. Get into the shade right, drink water and see a doctor if symptoms persist.

Treating and preventing leg cramps 

The best way to relieve leg cramps, according to the Mayo Clinic, is to:

  • Flex or pull your toes and foot back toward you
  • Massage the tight muscle, with ice if necessary
  • Walk around until the pain subsides
  • Relax the muscle with a warm bath or hot shower

You can also help prevent ordinary nighttime leg cramps by drinking plenty of fluids (to stave off dehydration), stretching for several minutes before you go to bed and avoiding tucking in the sheets too tightly around your feet, according to the Mayo Clinic. Some experts also recommend doing squats daily, especially if you spend too much time sitting.

Some people swear by eating a banana or two a day to get more potassium in their system. This idea may have merit because a dearth of potassium, calcium or magnesium in your diet can lead to leg cramps. Allen also notes that if you’re taking a medication that depletes these minerals, such as diuretics prescribed for blood pressure, see your doctor: The medication may be the culprit.

Related: Losing the Nerve to Wear Skinny Jeans

Kathryn Olney is a freelance writer and editor who has served as a reporter and editor for California, San Francisco and Mother Jones magazines.