An itch can be maddening, but it might be saving you from feeling intense pain.

Scientists are trying to figure out once and for all how itch and pain are related. New research in the journal Neuron suggests itch is a way of blocking pain after it reaches a certain level of severity, referring to it as a “braking system” for your body.

“Pain detection systems need to be sensitive enough to protect the body from potential harm,” the study says, “but when exposed to strong painful stimuli, high sensitivity may generate too much pain and interfere with proper behavioral responses.”

Read: Here’s How to Stop The Itch of Poison Ivy From Within Your Skin

According to the findings, the relationship works in that your neurons that sense pain or itch both send their sensory information through something called gastrin-releasing peptide, or GRP, which helps to regulate how your body will respond to the sensations. For example, in response to strong pain, it could signal your body to release its own natural pain-relieving chemicals. That shared pathway helps to explain why sometimes an itch can come with pain such as a stinging feeling. Taking things a step further, the researchers found that feeling an itch can be connected to reduced pain — when those response-regulating GRP molecules were reduced in mice, their pain increased and their itchiness decreased.

“It might sound counterintuitive, but we suggest that this small group of cells actually functions like a braking system for pain,” study first co-author Shuohao Sun, a graduate student at Johns Hopkins University, said in a statement from journal publisher Cell Press. “This brake is not always triggered by the painful stimuli; it’s only triggered by the strong pain stimuli. When the brake is on, the signal doesn’t go through. But when you have a weak pain signal, it doesn’t trigger the brake and the signal can go through.”

The system represents a way for creatures to still feel weak pain. But, according to Cell Press, the pain management that the “brake” provides could help an injured animal escape from a predator.

Our understanding of itch as it relates to pain has evolved in recent years. The two are linked, but itch was once regarded as a type of pain rather than its own sensation. A few years ago, according to Scientific American, scientists confirmed that itchy sensations are detected by their own special neurons, separate from the ones that detect pain and heat.

Apart from better understanding how the human body works, new information about the relationship between itch and pain, and how our brains respond to them, could one day help treat people with chronic pain and itch, estimated to affect about 10 percent of the U.S., Cell Press says.

“The next step is moving even further into the central nervous system and seeing how the [sensory] signal … is getting to the next relay station” after the GRP, study coauthor and Johns Hopkins neuroscientist Xinzhong Dong said. “We go one step at a time.”

Source: Dong X, Sun S, Xu Q, Guo C, Guan Y and Liu Q. Leaky Gate Model: Intensity-Dependent Coding of Pain and Itch in the Spinal Cord. Neuron. 2017.

See also:

The Science of Why Your Skin Doesn’t Leak

What is Plaque Psoriasis? A Painful Skin Condition

Weird Home Remedies for Oily Skin