Diets that replace carbohydrates with protein or fat should be avoided due to a possible association with shortened life spans, scientists have warned.
Eating carbohydrates in moderation seems to be optimal for health and living a long life, the research found.
The study, published in the Lancet Public Health journal, said low-carb diets are popular in Europe and the US, where the research was carried out.
The findings also suggest that while replacing carbohydrates with animal-based proteins and fats from foods like beef, lamb, pork, chicken and cheese was associated with a greater risk of mortality, eating more plant-based proteins and fats from foods such as vegetables, legumes and nuts was linked to lower mortality.
The observational study of more than 15,400 people in the US found that diets both low and high in carbohydrates were linked with an increase in mortality, while moderate consumers had the lowest risk of mortality.
The primary findings were confirmed in a meta-analysis of studies on carbohydrate intake including over 432,000 people from more than 20 countries.
Dr Sara Seidelmann, clinical and research fellow in cardiovascular medicine from Brigham and Women's Hospital, Boston, who led the research, said: "We need to look really carefully at what are the healthy compounds in diets that provide protection.
"Low-carb diets that replace carbohydrates with protein or fat are gaining widespread popularity as a health and weight loss strategy.
Previous trials have shown low-carbohydrate diets are beneficial for short-term weight loss, but there have been conflicting results from research on the long-term impact of carbohydrate restriction on mortality.
The authors said previous studies have not addressed the source or quality of proteins and fats consumed in low-carb diets. They analysed the dietary habits of 15,428 adults aged 45 to 64 from diverse socioeconomic backgrounds from four US communities.
All participants reported consuming 600 to 4,200 kcal per day for men and 500 to 3,600 kcal for women, with those with particularly high or low caloric intake excluded from the analysis.
During a median follow-up of 25 years, 6,283 people died. Results showed a U-shape association between overall carbohydrate intake and life expectancy, with low (less than 40% of calories from carbohydrates) and high (more than 70%) intake of carbohydrates associated with a higher risk of mortality compared with moderate intake (50%-55% of calories).
The researchers estimated that from the age of 50, the average life expectancy was an additional 33 years for those with moderate carbohydrate intake - four years longer than those with very low carbohydrate consumption, and one year longer than those with high consumption.
However, the authors highlight that since diets were only measured at the start of the trial and then six years later, dietary patterns could change over 25 years, which might make the reported effect of carbohydrate consumption on lifespan less certain.
They also said their findings show observational associations rather than cause and effect.
Dr Ian Johnson, emeritus fellow at the Quadram Institute Bioscience in Norwich, said: "The national dietary guidelines for the UK, which are based on the findings of the Scientific Advisory Committee on Nutrition, recommend that carbohydrates should account for 50% of total dietary energy intake.
"In fact, this figure is close to the average carbohydrate consumption by the UK population observed in dietary surveys. It is gratifying to see from the new study that this level of carbohydrate intake seems to be optimal for longevity."