Spanish prison authorities were 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, then-29-year-old Gonzalo Montoya Jiménez, was found unresponsive in his cell during a morning roll call on 7 January 2018 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 northwest 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 realize 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 was eventually reported to be in a stable condition – but as for how the mix-up could have occurred in the first place, prison authorities seemingly had 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 was unknown exactly what caused his condition, officials described his body as showing signs of cyanosis – a purplish discoloration of the skin caused by poor circulation or lack of oxygen – in addition to rigor mortis.

Hospital officials 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 experienced epilepsy, and takes medication for the condition – but his family said it wasn't always easy for Jiménez to adhere to his medication schedule in lock-up, so that might have had something to do with it.

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

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

A version of this article was first published in January 2018.