The good news is that following a healthy diet and exercise regimen definitely helps stave off chronic conditions like heart disease. The bad news is, if you are doing one but not the other, you’re not doing enough. As the old saying goes, “You can’t outrun your diet.” It turns out you also can’t eat your way off the couch.

A study published recently in the British Journal of Sports Medicine suggests that hitting the gym won’t counteract the consequences of consuming fat-laden foods, and eating clean can’t cancel out sedentary habits. The authors said it was the first study to examine diet and exercise alongside both general mortality and specific lethal diseases, like cancer.

An international team of researchers examined data from nearly 350,000 participants collected from the U.K. Biobank, a massive medical database with health information from people across Britain. They followed up over a decade. The study participants, median age 57, were healthy at the study’s start, meaning they were not diagnosed with cardiovascular disease, cancer or chronic pain.

A high-quality diet had at least 4.5 cups of fruit and vegetables per day, two or more servings of fish per week, less than two servings of processed meats per week and no more than five servings of red meat per week. The study did not measure so-called discretionary foods like soft drinks or desserts.

Participants filled out another questionnaire that asked about the total minutes spent walking and engaging in moderate physical activity, like carrying light loads or biking at a steady pace, and vigorous physical activity that lasted more than 10 minutes at a time.

Not surprisingly, people with both higher levels of physical activity and better quality diets had the lowest mortality risk. Even just 10 to 75 minutes per week made a difference.

Stephen Ward, MD, an internist with Hartford HealthCare’s Medical Group, said that combining a healthy diet with exercise that builds muscle helps prevent chronic conditions like arthritis, heart disease, even cancer.

“Lifestyle is everything,” he said. “Being prevention-oriented rather than reactive. Thinking, ‘I can eat whatever I want and fix it later’ is not the way we want to go.”

He said avoiding processed foods is a great place to start building a healthier diet. And a walk around the high school track is not going to make you “healthy.” Incorporating strength training into your regimen, even with light weights, fires up your metabolism and gets your body building muscle and burning fat, he said.