Weight loss surgery saves and extends the lives of patients, according to a new study that took 40 years to complete.

Published in the journal Obesity on Wednesday, the study focused on the all-cause and cause-specific mortality for bariatric surgery procedures.

The long-term study had 21,837 participants who had weight loss surgery in Utah. Follow-up on the patients spanned up to 40 years.

The team found that weight loss surgery reduced the risk of premature death from obesity-related conditions, including cancer, diabetes and heart disease.

According to the researchers, people who had one of the four types of weight loss surgery procedures (gastric bypass, gastric banding, gastric sleeve and duodenal switch) were found to be 16% less likely to die from any cause compared with those of similar weight who did not undergo surgery.

For both females and males, a significant drop in mortality rate was observed after bariatric surgery. To be exact, the mortality rates for cardiovascular disease, cancer and diabetes dropped by 29%, 43% and 72%, respectively.

“Deaths from cardiovascular disease decreased by 29%, while deaths from various cancers decreased by 43%, which is pretty impressive,” lead author Ted Adams said, as quoted by CNN.

Adams is an adjunct associate professor in nutrition and integrative physiology at the University of Utah’s School of Medicine.

He continued, “There was also a huge percentage drop — a 72% decline — in deaths related to diabetes in people who had surgery compared to those who did not.”

However, the findings in the study were not limited to the positive effects of the weight loss procedures on the mortality rate of the participants.

One downside that the scientists observed was younger people (18-34) who had weight loss surgery had a higher risk for suicide than those who did not have surgery.

“Rate of death from suicide was significantly higher in surgery versus non-surgery participants only in the youngest age at surgery participants,” the team wrote.

The authors hope their findings could help address the suicide rates in the younger age group by inspiring more aggressive pre-surgical psychological screening and post-surgery follow-up.

A previous study from Sweden published in 2013 presented similar findings to the new study. The older research, which spanned ten years, reported significant reductions in premature deaths after bariatric surgery.