Most muscle cramps are caused by nerves malfunctioning. During a cramp, the muscle contracts by itself due to abnormal nerve signals. Muscle cramps can be painful. They may happen more often after exercise or at night. Stretching the muscle can relieve cramp pain.