The infant, born after just 23 weeks on Wednesday morning in the city of Puebla, southeast of Mexico City, was thought by medics to be dead at birth.

Medical personnel from La Margarita General Hospital informed the parents their baby had died, allegedly sending the child to the morgue where it would remain in a refrigerator for six hours, infobae reports.

The parents were even allegedly handed the baby’s death certificate as they reportedly planned to hire funeral services.

It wasn’t until six hours later that staff from a local funeral home said they realized the baby was alive.

Funeral Home director Miguel Ángel Flores of Funeraria Flores said he noticed the newborn was crying and moving when staff went to collect the body from the morgue.

“The driver realized that the baby was alive, but I told him that he died at four and from four to ten, the baby was refrigerated for six hours,” Flores told Telediario televisión.

“When we got to remove the body, we noticed that he began to cry and move,” Flores continued.

“We told the father to come closer and he also saw that he was crying, so they brought the doctor down, who is the one who made the death certificate.”

A video posted online by local journalist Javier López Díaz shows the baby wrapped in a blue blanket with identification tags around its arm and leg.

The tiny child can be heard emitting sound and moving its feet as a man’s voice is also heard saying “Here I am, I’m your daddy … hold on, my love.”

The delegation of the Mexican Institute of Social Security (IMSS) issued a statement saying an investigation was underway to determine who was responsible for the mistake.

“The extremely premature newborn protocols were applied, but he did not present vital signs, so death was certified. He was transferred to the mortuary area,” the statement read.

“Upon delivering the body to the relative, the medical and funeral home staff realized that the baby was alive. He immediately received supportive medical care, and was transferred to the Neonatal Intensive Care Unit of HGZ No. 20.”

The baby is currently under medical observation in an intensive care neonatal unit, local media reports.

The baby’s father, Santiago Albino Hernández, told Canal 13 Puebla it is a miracle his son is still alive and confirmed the child was in a stable condition.