(CNN) Children who are breastfed for two years or longer are more likely to have dental cavities, according to a study published Friday in the journal Pediatrics .

Researchers analyzed breastfeeding behaviors and sugar consumption for 1,129 children in Pelotas, Brazil. At age 5, the children visited a dentist, and were examined for decayed, missing and filled primary tooth surfaces and severe early childhood caries, or severe cavities. Severe early childhood caries were defined as six or more decayed, missing and filled primary tooth surfaces.

Among the children in the study, 23.9% had severe cavities and 48% had at least one tooth surface affected by a cavity. Kids who were breastfed for two years or longer had a 2.4 times higher risk of having severe cavities, compared to kids who were breastfed for less than a year.

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

However, the study found that breastfeeding between 12 and 23 months did not bring with it a higher risk of cavities. About one quarter of the kids were breastfed for 24 months or longer.

Breastfeeding and dental health

Márcia Vitolo, a professor of health sciences at the Federal University of Health Sciences in Porto Alegre, Brazil, said that she too believes breastfeeding at a high frequency, as well as the amount of sugar eaten, could explain the reason for these study results. Vitolo was not involved in this study but has done similar studies of her own.

"I believe that there is association between breastfeeding and cavities when the environment is unhealthy -- like there is a high frequency of breastfeeding during day and night and consumption of sweets and candies," said Vitolo.

The study also found an association for socioeconomic characteristics that can contribute to a higher risk of a child having dental caries. If a family had a lower income or the mother had less schooling, children had more dental cavities and were at a higher risk of having severe cavities.

Other studies measuring the relationship between long-term breastfeeding and dental cavities have had mixed results -- though this could be due in part to the researchers looking at cavities in children of different ages and defining prolonged breastfeeding by different time ranges.

Vitolo, who conducted a similar study in Porto Alegre, Brazil, also found that children who breastfed more than 24 months had a two times higher risk of developing severe cavities. Two other research studies conducted on children in Germany and Italy found an association, while another in Brazil did not.

But Peres says it's important to remember that since this study was conducted in Brazil, the results may not be as applicable to other parts of the world.

"I believe that general extrapolation of our findings is uncertain, suggesting that this could be made only for populations with similar patterns of breastfeeding and exposure to fluoride," said Peres.

Fluoride in water can prevent tooth decay and protect against cavities. Pelotas, Brazil, has had a fluoridated water supply since 1962.

Breastfeeding has been found to have certain dental benefits. Another study by Peres found that babies are 72% less likely to have crooked teeth if they are breastfed exclusively for six months. Breastfeeding can also reduce the risk of a condition called baby bottle tooth decay , which is most often associated with babies' teeth being exposed to sugary drinks for an extended period of time. This sometimes occurs when babies are put to bed with a bottle, or a bottle is used as a pacifier.

Breastfeeding provides babies with the essential nutrients for growth and development, while also reducing the risk of infectious diseases, ear infections, diarrhea and even death. For mothers, breastfeeding can help them return to their pre-pregnancy weight faster, while also reducing the risk of ovarian and breast cancer.

The American Academy of Pediatrics says there are very few reasons not to breastfeed, though certain illnesses or conditions may prohibit it. A doctor should always be consulted to determine whether a mother can safely breastfeed.

Preventing cavities in young children

Dr. Ruchi Sahota, a family dentist and spokeswoman for the American Dental Association, said that while breastfeeding does seem to have certain dental benefits on its own, the most important thing that moms can do is prevent cavities early on.

"Even breast milk has sugar in it. That's why babies love it," said Sahota. "So that's also why we need to make sure we're wiping down baby's gums after they eat with a moist cloth. And then brushing the teeth twice a day, when they come in, with a rice-sized amount of fluoride toothpaste. And it's really important to see your family dentist."

Sahota recommends parents bring their child to the dentist as soon as the first tooth comes in. She also said it's important for parents to take care of their own teeth, because if they share a spoon with their child but they have cavities, the cavity-causing bacteria can be passed along.

Education is key when it comes to cavity prevention, Sahota said.

"What I can tell you is the moms that I see while they are pregnant, those are the moms that I have the opportunity to educate and talk to about prevention," she said. "Then whether they breastfeed or not, just those nuggets of education play a big role in preventing cavities."

"Ultimately, what this study shows me is that breastfeeding up to 24 months is OK," said Sahota. "And then if you choose to breastfeed after 24 months, be sure that you're also employing preventative methods to avoid cavities."