Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

An Alabama woman has been reunited with her newborn after test results proved she did not have opiates in her system when her baby was taken away from her four hours after delivery.

Instead, her doctor said, she may have tested positive for drugs because she had eaten poppy seed bread the previous day.

Rebecca Hernandez, of Huntsville, Alabama, gave birth to a healthy baby boy on Tuesday at Crestwood Medical Center and was subsequently drug tested. When the test came out positive for opiates, medical staff called the Alabama Department of Human Resources, which took away her baby.

But the test later turned out to be a false-positive.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Crestwood Medical declined to comment on why Hernandez was drug tested in the first place but said in a statement Saturday that it is "committed to following the law and regulatory requirements as well as ensuring the health and safety of our patient."

Hernandez said in an interview Thursday with NBC affiliate WAFF in Huntsville that what happened was a "nightmare" for her family.

"A newborn baby has to be close to mom," she said in Spanish. "They have to be with the mom. That’s the most important time in their life to be close to the mom when they’re just born.”

Her doctor, Yashica Robinson, learned Hernandez had eaten poppy seed bread the day before delivery and thought it might have caused the positive result.

“Screening tests can have what we call false-positive results where other things can interfere," Robinson told WAFF. "You can have a substance that a patient eats. Like in this case, poppy seeds can make them test positive for opioids.”

Robinson said same-day drug screenings are a problem, and hospitals should rely on laboratory confirmed tests, the type that showed a negative result for Hernandez, before taking away children. The baby also tested negative for opiates.

Robinson said erroneous results can harm patients.

“I understand everything is a process. I understand you have to follow rules," Hernandez said. "They should’ve done some more research before they decided to call DHR.”

An AL.com and ProPublica investigation in 2015 found that Alabama has some of the toughest laws targeting drug use during pregnancy. In many parts of the state, hospitals test mothers without their consent, and tests are often done on a case-by-case basis that the investigation said uses "criteria that virtually ensure greater scrutiny for poor women."