If you breast-feed your babies for more than two years, you could be putting them at risk for getting cavities in the future, new research suggests.

There haven't been many studies looking at how breast-feeding, bottle-feeding and sugar consumption affect children's risk for cavities, according to the researchers. So they designed a study to examine whether the length of breast-feeding alone is a risk factor for cavities separate from sugar consumption. The study of 1,129 children in Pelotas, Brazil, was published Friday in Pediatrics.

Children in the study went to a dentist at age 5, where they were evaluated for filled, decayed and missing primary tooth surfaces, and for severe cavities, CNN reports. Nearly one-quarter had severe cavities, or six or more filled, decayed or missing primary tooth surfaces. Those breast-fed for two years or more had double the risk of severe cavities than those breast-fed for under one year.

"There are some reasons to explain such an association," study author Dr. Karen Peres told CNN. "First, children who are exposed to breast-feeding beyond 24 months are usually those breastfed on demand and at night. Second, higher frequency of breast-feeding and nocturnal breast-feeding on demand makes it very difficult to clean teeth in this specific period." Peres is also an associate professor at the University of Adelaide in Australia.

That's not to say breast-feeding doesn't have benefits for teeth. Peres discovered that babies breast-fed for just six months are 72 percent less likely to develop crooked teeth.

Breast-feeding recommendations vary: The American Academy of Pediatrics suggests one year of breast-feeding and then re-assessing if both mother and child want to keep going; the World Health Organization suggests breast-feeding go on for as many as two years or more.

"Ultimately, what this study shows me is that breastfeeding up to 24 months is OK," Dr. Ruchi Sahota, an American Dental Association spokeswoman and family dentist, told CNN. "And then if you choose to breastfeed after 24 months, be sure that you're also employing preventative methods to avoid cavities."

Researchers recommend preventative care measures and further study to alleviate the problem.

"Preventive interventions for [cavities] should be established as early as possible because breast-feeding is beneficial for children's health," according to the study. "Mechanisms underlying this process should be investigated more deeply."