Royal Thai Navy SEALs(CHIANG RAI, Thailand) — Thai Navy SEALs who were clearing the flooded cave where 12 boys and their soccer coach were rescued, barely made it out after the main pump that had been siphoning water out of the cave failed, military officials who were directly involved in the operation told ABC News.

The system, which had pumped hundreds of millions of gallons of rainwater out of the cave over the past 18 days, gave out soon after rescuers extracted the coach and the four Thai Navy Seals who had volunteered to stay with them. Thai SEALs and support teams, who were carrying air tanks from the third to the second chamber of the labyrinthine cave, soon noticed the waters rising. The third chamber filled, then the second and then the first, as crews scrambled to avoid the kind of cave flooding that had trapped the soccer team on June 27, according to officials.

Dozens of military personnel and civilians began abandoning the cave, leaving behind hundreds of air tanks. Some of the tanks belonged to the SEALs. Others had been donated by the king of Thailand, officials said.

On Tuesday, the remaining four boys and the coach were successfully rescued from the cave at the base of a mountain known locally as the Sleeping Princess. That day’s rescue took about nine hours, according to Thai Navy SEALs. They emerged from the cave to cheers by the military and support staff, officials said.

The Tham Luang Nang Non cave, located within the Khun Nam Nang Non Forest Park, is known in Thailand as the country’s longest cave. It’s twisting six mile long passageways reach all the way into the neighboring country of Myanmar.

The officials said the pumps lasted just long enough to successfully rescue the final four boys and their soccer coach. The five hauled out nearly at once in a long convoy of divers, support teams, and medics, according to the sources. Each of the nine chambers had a doctor waiting, and the boys were evaluated at each chamber.

The boys were given anti-anxiety medication before they were rescued, Thai Prime Minister Prayut Chan-o-cha revealed, according to The Associated Press.

“Like us, we take antihistamines to make us feel well, not excited, not writhe, not taking the mask out,” the prime minister said. “It’s called Anxiolytic — something to make them not excited, not stressed.”

None of the 13 survivors had diving experience and most couldn’t swim, according to local officials.

The rescued were finally carried out on stretchers from the second chamber, wearing surgical masks to ward off germs, and sunglasses because of their new sensitivity to light, the officials said.

The youngest of the group, who was very weak, was the first one to be whisked away in an ambulance Tuesday. His condition was apparently of such concern that medics didn’t even wait for police cruisers to escort them to a nearby helipad, the officials said.

The coach was the last one out and seemed to have been suffering from hypothermia as he emerged from the cave shivering and wrapped in a thermal blanket, said the officials.

After their discovery deep in the belly of that cave, divers began to deliver sticky rice and pork in waterproof bags to the four SEALs and the soccer team, according to the sources. The food had been cooked in the camp right outside the mouth of the cave, but the boys could only nibble on the rice because they’d grown so weak, the officials said.

The “Wild Boar” youth soccer team and its 25-year-old coach were exploring the cave on June 23 when heavy rains flooded their exit route.

The search-and-rescue operation began on Sunday just ahead of monsoon rainstorms that pelted the region early Wednesday and threaten to flood the cave again.

A team of 19 divers entered the cave to replenish oxygen supplies, and two divers escorted each of the boys out of the underwater labyrinth, officials said.

One volunteer died from what the Thai Navy Seals called a “medical condition” as he was restocking supplies along the route.

Copyright © 2018, ABC Radio. All rights reserved.

Source: World News