Babies born to women who take opioid painkillers such as codeine or oxycodone just before or in early pregnancy moderately increased the risk their babies would have birth defects, according to a study released Wednesday by the Centers for Disease Control and Prevention (CDC).

Treatment with opioids was linked to several types of congenital heart defects as well as spina bifida, hydrocephaly (a buildup of cerebrospinal fluid), congenital glaucoma and gastroschisis (a fissure in the abdominal wall). The findings with some congenital heart defects are consistent with previous studies.

This study found that women who took prescription opioid pain killers s just before or during early pregnancy were about twice as likely to have a baby with hypoplastic left heart syndrome, a sometimes life-threatening heart defect, as women who had not taken opioids.

Congenital heart defects are the most common type of birth defect, affecting nearly 40,000 births in the United States each year. Many infants with congenital heart defects die in the first year of life, and infants who survive often require numerous surgeries, lengthy hospitalizations and a lifetime of treatment for related disabilities.

While some medications are known to be harmful when taken during pregnancy, the safety of most medications taken by pregnant women has not been determined.

"Women who are pregnant, or thinking about becoming pregnant, should know there are risks associated with using prescription painkillers," said CDC Director Thomas R. Frieden. "They should only take medications that are essential, in consultation with their health care provider."

The CDC said information this study was conducted to help health care providers weigh the benefits of prescribing opioid medications to women who are pregnant or might become pregnant.