ABC News July 10, 2018

Navy SEALs who rescued Thai soccer team from cave almost didn't make it out, military officials say

WATCH: Doctors credit age of Thailand boys' soccer team for surviving inside the cave

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, Thai military sources 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 Thai military sources.

Tyrone Siu/Reuters
Divers walk inside Tham Luang cave complex, where 12 schoolboys and their soccer coach are trapped inside a flooded cave, in the northern province of Chiang Rai, Thailand, July 7, 2018.

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, Thai military sources 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, Thai military sources said.

Linh Pham/Getty Images
Onlookers at the junction in front of Chiangrai Prachanukroh Hospital watch and cheer as ambulances transport the last rescued schoolboys and their coach, July 10, 2018, in Chiang Rai, Thailand.

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 Thai military sources 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 Thai military sources.

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 Thai military sources said.

(MORE: 'Miracle' or 'science': Divers pull off improbable feat of rescuing Thai soccer team) (MORE: Thai cave where dramatic rescue of 12 boys and coach unfolded may become tourist attraction: Official) (MORE: The boys trapped in the Thailand cave could face an unusual disease)

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 Thai military sources 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 Thai military sources.

Royal Thai Navy SEALs
The three Royal Thai Navy SEAL divers and medics who stayed in the cave with the boys and coach since they were located on July 2. Officials said they emerged from the cave "healthy" shortly after the last rescues were made, July 10, 2018.

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 Thai military sources said.

Royal Thai Navy via AP
Thai rescue teams arrange a water pumping system at the entrance to a flooded cave complex where 12 boys and their soccer coach have been trapped since June 23, in Mae Sai, Chiang Rai province, northern Thailand in this undated photo released by Royal Thai Navy, July 7, 2018.

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, Thai military sources said.

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

Soe Zeya Tun/Reuters
Rescue workers take out machines after 12 soccer players and their coach were rescued in Tham Luang cave complex in the northern province of Chiang Rai, Thailand, July 10, 2018.