Spending more time in the sun could help prevent Type 2 diabetes.

A new study finds that people with lower levels of vitamin D are more likely to have diabetes, a disease that occurs when blood sugar levels are too high for the body to manage.

And the easiest way to get vitamin D is simply hanging out in the sun. The nutrient is usually formed underneath the skin in sunlight, but it's also in milk, fish and eggs.

The study's author said in a press release, "The average person may be able to reduce their risk by maintaining a healthy diet and getting enough outdoor activity."

The vitamin helps maintain healthy bones and teeth, while also aiding cell growth and the immune system. (Video via CBS)

Obesity is commonly attributed as a cause of diabetes, but the study found that people who were not overweight but had low levels of vitamin D were more likely to have the condition.

However, the study did not determine if low vitamin D levels caused diabetes. It merely suggested the two are associated.

"Thank God we have vitamin D because it's one of the most important vitamins out there," said one medical expert on Fox News.

Higher levels of vitamin D don't just help prevent diabetes. Other studies have suggested that the vitamin could lower the risk of heart issuescolon cancerAlzheimer's disease and lead to a longer life.

The most recent findings were published Monday in The Journal of Clinical Endocrinology & Metabolism.

This video contains images from Getty Images.