Study after study has shown that where Americans live has a big effect on how long they live. A new study out Monday finds that difference works out to as much as 20 years.

And it also shows that obesity and diabetes — caused by poor diet and a lack of exercise — could be responsible for a big chunk of that difference in life expectancy.

Image: Life Expectancy at Birth by County, 2014
Map of life expectancy at birth by U.S. county, 2014. Image: Life Expectancy at Birth by County, 2014 / American Medical Association

The longest life expectancy — up to 87 years — was in central Colorado’s ski country. The lowest — 66 years — was found in southwest South Dakota, with other parts of the Dakotas, Appalachia and the Mississippi river basin close behind.

Dr. Christopher Murray and colleagues at the University of Washington looked at life expectancy and risk of death for each county across the U.S. from 1980 to 2014.

Related: Where You Live Determines What Kills You

Overall, they confirmed Americans are living longer. Boys born in 2014 can expect to live to be 77 and girls to 81.5. But there is a 20-year difference when lifespans are looked at county by county, Murray’s team found. That’s an average of five years longer than in 1980.

“Several counties in South and North Dakota (typically those with Native American reservations) had the lowest life expectancy, and counties along the lower half of the Mississippi and in eastern Kentucky and southwestern West Virginia also had very low life expectancy compared with the rest of the country,” they wrote in their report, published in the Journal of the American Medical Association’s JAMA Internal Medicine.

“In contrast, counties in central Colorado had the highest life expectancies,” they wrote.

As other studies have shown, economic status and ethnicity had a lot to do with life expectancy. Affluent whites tend to live longer than poor people and than blacks and Native Americans.

Related: Death by Zip Code

But when the team broke those differences down even more, they found that “behavioral and metabolic risk factors” accounted for 74 percent of the differences. Smoking and obesity — itself caused by poor diet and lack of exercise — are the major culprits when Americans die too young.

Image: Change in Life Expectancy at Birth by County, 1980 to 2014
Map of change in life expectancy at birth by county, 1980 to 2014. American Medical Association

“This study found large — and increasing — geographic disparities among counties in life expectancy over the past 35 years. The magnitude of these disparities demands action, all the more urgently because inequalities will only increase further if recent trends are allowed to continue uncontested,” the team wrote.

Access to health care accounted for much of the rest of the difference, the team found.

Related: Native American Health Facilities ‘Horrifying’, Senate Hears

The Indian Health Service has been strongly criticized for failing to provide adequate health care, especially on some reservations in the Dakotas.

And the U.S. is embroiled in a new debate over how best to deliver health care, with Republicans in Congress seeking to repeal and rewrite the 2010 Affordable Care Act, credited with getting health insurance to 20 million Americans who did not have it before, while being criticized for failing to lower costs.

Related: Idaho Republican Labrador Booed Over ‘Nobody Dies’ Comment on Health Care

State legislatures and city councils are also arguing over whether to tax or restrict the sale of sugar-sweetened soft drinks and fatty foods that are blamed for worsening obesity.