The findings were published in the journal Evolution and Human Behavior and showed that grandparents who care for their grandchildren ― as well as older people who care for others within their social networks ― enjoy significantly longer lifespans.

Using data from the Berlin Aging Study, the researchers analyzed the longevity and caregiving habits of more than 500 people between the ages of 70 and 103. The study did not look at primary caregivers, instead comparing grandparents who acted as occasional caregivers with those who did not, in addition to older adults who did not have children or grandchildren but cared for people within their social network.

Those who did not have a role helping others were significantly more likely to have died within just five years of the initial testing period.

This effect also extended beyond family ties. Childless older adults who provided emotional support to others within their social network lived for an extra seven years on average, while childless older adults who did not report helping or supporting others lived for only an extra four years on average.

But it’s important to note that too much caregiving often has just the opposite effect. There’s a clear link between primary caregiving and a number of negative physical and mental health consequences, often resulting from high levels of chronic stress.

“Helping shouldn’t be misunderstood as a panacea for a longer life,” Dr. Ralph Hertwig, a psychologist at the Max Planck Institute for Human Development in Germany, said in a press release. “A moderate level of caregiving involvement does seem to have positive effects on health, but … more intense involvement causes stress, which has negative effects on physical and mental health.”

Although the new study only focused on older adults, it’s safe to assume that the health benefits of helping and taking care of others extend to those of all ages.

There may be an evolutionary explanation as to why we’re rewarded for supporting others, within both our own family and the larger social community.

In other words, taking care of others may be hard-wired into the human brain. To be good to yourself and your own health, try being good to others.