Xisco Gràcia started exploring caves when he was a boy. The area around his boyhood village was dotted with caves he could easily explore on foot. Gràcia and his friends would spend hours searching the labyrinths, sometimes missing meals because they were so busy exploring.

As he grew older and became passionate about scuba diving, becoming a cave diver was the logical next step. In 1994, he started training in cave diving and eventually became a geology teacher and a trained speleologist, a scientist focused on the study of caves.

Gràcia is part of a team of 13 speleologists that regularly explore, research and map the underwater caves of Majorca (Mallorca in Spanish), a Mediterranean island off the coast of Spain. “Majorca is much more beautiful underground than above ground,” Gràcia told the BBC World Service in an interview.

The Fateful Dive

On Saturday April 15, 2017, Gràcia and his dive buddy Guillem Mascaró entered the water for a dive to Cova de sa Piqueta, a sprawling underwater cave system. While routine—Gràcia and Mascaró are both highly trained and experienced cave divers—Sa Piqueta is a complicated dive site, with numerous underground chambers about one kilometer from the cave entrance. On this dive, Mascaró planned to map a chamber deep inside the cave.

They separated briefly as Mascaró went to map the chamber and Gràcia collected rock samples. After completing their respective tasks, they bumped into each other at a junction between two chambers. The collision stirred up silt from the ground, making it very difficult to see.

To make matters worse, they couldn’t find the guideline they had laid to help them get back to the cave’s entrance. They spent precious time searching for the guideline, but could not find it in the murky water. By the time they found the rope—it had snapped on the edge of a sharp rock—both divers had violated the rule of thirds (one third of your oxygen for the way in, another third for the way out, and another for emergencies) and were getting dangerously low on oxygen.

Gràcia and Mascaró were now in dire straits. Running out of air, barely able to see and unsure if they could find their way out, they travelled to a nearby chamber of which they knew it had an air pocket where they could discuss their options. The two resolved that the best plan of action was for one of them to stay behind in the air pocket while the other went to get help.

"We decided I would stay and Guillem (Mascaró) would go for help. He was skinnier than me and needed less air for breathing,” said Gràcia, “I was also more experienced at breathing cave air, which has higher carbon dioxide levels."

Thus began the nightmare of Gràcia’s life.

Alone in a Cave

While Mascaró set off for the cave entrance, Gràcia took off his scuba gear, hoisted himself onto a flat rock, and took stock of his surroundings. The air pocket was surprisingly large, about 80 meters (262 feet) long by 20 meters (65 feet) wide, with a 12-meter (40-foot) gap between the water and the ceiling.

The chamber’s large size boded well for Gràcia’s chances of survival. Theoretically he could wait for a significant amount of time and still have air to breathe while he waited to be rescued. But his chances of survival depended completely on something out of his control: his dive buddy making it out alive and getting help in time.

The cavern was completely dark. While searching for a possible exit he found a source of freshwater that, while brackish, was drinkable. As time wore on, the battery on his primary torches had expired, so he had to use his backup sparingly. He only used it to find drinking water and to urinate. The rest of the time was spent in total darkness.

At first, Gràcia was hopeful that his partner would find his way out and return with an emergency crew. After 7 or 8 hours, hope turned to fear. Fear that his friend lost his way and died. Fear that no one knew where he was and that rescue would not come. Fear that he would never see his family again. Fear he would die a slow death. Alone. In a cave. In the dark.

The air in in the cave was toxic, containing up to 5% carbon dioxide (normal air contains approximately 0.04% carbon dioxide) and low levels of oxygen. Breathing in this cave air took a physical and mental toll. Gràcia suffered a constant, severe headache that rendered him unable to sleep. His mind played tricks on him and he started hallucinating, seeing lights where there were none. He started hearing bubbles but saw no diver blowing them.

Hours turned to days and there was still no sign of rescue. Gràcia was under immense psychological stress. At one point, he even grabbed his dive knife, thinking that he would rather die a quick death by his own hands rather than a slow one from starvation or suffocation.

A Rescue for the Ages

While Gràcia suffered in the darkness, his dive buddy had successfully exited the cave, without the help of a guide wire, and raised the alarm. The local police hastily initiated a rescue operation, enlisting other experienced cave divers—some of them friends of Gràcia—to save the trapped diver. Unfortunately, the first rescue attempt was called off due to poor visibility, prolonging Gràcia’s ordeal.

The first sign Gràcia had that his friend had made it out alive was the sound of a drill above him. When rescue efforts stalled, the rescue team attempted unsuccessfully to drill a hole into the cave to provide Gràcia with food and water. After waiting another day for the silt to settle, two rescue divers successfully made it through.

When Gràcia heard bubbles—real bubbles, this time—he shone his torch and saw the face of an old friend, Bernat Clamor, emerge from the water. The two embraced and Gràcia finally knew he would survive.

Clamor informed Gràcia that he would need to leave him in the cave for a little longer, as he went back to notify the rescue team. He gave Gràcia some glucose packets to help boost his energy levels.

“It would take eight more hours to get me out of that cave, but they were eight happy hours,” said Gràcia.

Clamor returned with new tanks of enriched air for Gràcia to breathe. He slowly guided Gràcia out of the cave and to freedom and safety. Gràcia returned the surface on Monday April 17th, a full 60 hours after he started his dive. Emergency medical services treated him and he spent a short time in hospital.

Enrique Ballesteros, a member of the civil police’s underwater task force, told Spanish newspaper El Mundo that the decision to send Mascaró alone to the surface is ultimately what saved Gràcia’s life. “They could have tried to stretch out the remaining oxygen but surely that would have been suicide and they would’ve both died,” he said.

The near-death experience has not shaken Gràcia’s love of diving and he has vowed to continue mapping the caves of Majorca. Just two weeks ago, Gràcia returned to the same cavern in which he was trapped, to do some mapping and to analyse the air.

“I have spent 24 years exploring underground,” he said, “it’s in my blood.”