Spanish prison authorities are baffled after a prisoner who was declared dead by three separate doctors woke up in the morgue – just hours before his own autopsy was set to commence.

The prisoner, 29-year-old Gonzalo Montoya Jiménez, was found unresponsive in his cell during a morning roll call, and had been transferred to a hospital mortuary in a body bag when pathologists heard something strange.

Snoring. Coming from inside the bag.

Jiménez, who was serving time for robbery in the maximum security wing of Asturias Central Penitentiary in north-west Spain, was first attended by two doctors on duty in the prison, after he was found sitting unconscious in a chair in his cell, with no signs of violence being evident.

Sensing no vital signs, the doctors declared him dead, and an hour later a forensic doctor inspected the body, concurred with the first evaluations, and issued a third death report.

Only later in the morgue did physicians realise something was terribly wrong.

By this point, Jiménez had already spent time in a cold storage room to help preserve his body, and his skin had been marked with scalpel guidelines in preparation for his imminent autopsy – at which point the mistaken corpse suddenly stirred.

"Forensic doctors began to hear noises coming from inside the bag. Montoya was not dead. Quite the opposite," reported El Español.

"The forensic [pathologist] proceeded to open the bag and found the inmate still alive."

Jiménez was subsequently transferred under guard in an ambulance to another hospital to recover from his mystery episode, and now appears to be in a stable condition – but as for how the mix-up could have occurred in the first place, prison authorities seemingly have no idea.

"I can't comment on what happened at the Institute of Legal Medicine," a spokesperson for the Spanish Prison Service told the media, "but three doctors have seen clinical signs of death so it's still not clear at the moment exactly why this occurred."

The day before Jiménez was found 'dead', he complained of feeling ill, and while it's unknown exactly what caused his condition, officials described his body as showing signs of cyanosis – a purplish discolouration of the skin caused by poor circulation or lack of oxygen – in addition to rigor mortis.

Hospital officials have told Spanish media the faux fatality could be a case of catalepsy, in which the body enters a trance or seizure-like state, exhibiting a loss of consciousness and sensation, together with physical rigidity.

Just how Jiménez became cataleptic is unclear, although the prisoner experiences epilepsy, and takes medication for the condition – but his family says it isn't always easy for Jiménez to adhere to his medication schedule in lock-up, so that might have something to do with it.

His family, who have been allowed to visit Jiménez while he recovers in hospital, are contemplating legal action against the prison, convinced that only one doctor properly examined the prisoner's body, with the others simply copying the paperwork.

An official probe has now been opened to investigate what exactly happened here, and if any procedures weren't followed correctly.

In the hospital, it took 24 hours before Jiménez recovered consciousness in intensive care, and began to speak, which doctors say is a good sign.

When the 'dead man' woke up, he asked if he could see his wife.