For example, when you accidentally touch a hot stove, your hand withdraws immediately, an action that is mediated by spinal reflexes without requiring the extra time involved in sending the message to the brain. Repeated experiences of pain will lead to a chronic withdrawal of neck muscles.
An interesting way to think about this phenomena is in terms of Pavlovian classical conditioning; with repeated experiences, the neck “learns” to stay tight in anticipation of an attack of head pain, and conversely neck pain may begin to trigger headaches. This “forward feedback loop” is an important mechanism for progression of intermittent migraine to chronic migraine.
We distinguish two types of reactivity of neck muscles in headache, the type above being a learned or conditioned response. In some patients, however, there is “good cause” for continued guarding, which most commonly are from arthritic changes of the cervical spine (arthritis of the neck).
Arthritic changes of the neck may cause pain from the joints of the neck, as well as nerve or spinal cord impingement from narrowing of the spinal canal or of the exiting canals for nerves.
Nonsteroidal medications (aspirin, ibuprofen, etc.) are often used to reduce arthritis of the cervical spine, but their effectiveness is limited over time, and the risks of serious complications (including heart attack and gastroinestinal hemorrhage) rises over time.
The article linked here http://www.medscape.com/viewarticle/749328 suggests that chondroitin sulfate, a component of cartilage and essentially a food, can be effective for arthritis (at least of the hands) when taken over several months. The compound is used commonly in Europe for generalized arthritis. It may be advisable to start chondroitin sulfate when cervical pain occurs, or when headache is associated with arthritic conditions of the neck, along with an NSAID, and discontinue the NSAID after a few months, when chondroitin becomes effective.