Chiang Rai provincial acting Gov. Narongsak Osatanakorn, the local official in charge of the extensive search-and-rescue operation, said crews had to quickly evacuate the Tham Luang Nang Non cave as the first chamber refilled with water, soon after the last members of the soccer team and their coach were taken out Tuesday.
"You had to evacuate everything?" ABC News' Matt Gutman asked Narongsak during an interview Wednesday.
"Everything," Narongsak said.
Thai military officials directly involved in the operation told ABC News the main pump that was being used to decrease water levels inside the cave suddenly failed, and the cave began filling up with water from the heavy rain that day in northern Chiang Rai province.
Royal Thai Navy members and support teams barely made it out in time and were forced to leave behind about 300 air tanks in the cave, the officials told ABC News.
Had the boys been led out by rescuers a couple hours later, they would have had to swim more than twice the distance – about a mile instead of a half-- which Narongsak said he believes might have been impossible because some of the boys were too weak to really swim or walk. He called it a miracle that all 12 boys survived the ordeal.
The boys, ages 11 to 16, and their 25-year-old soccer coach became trapped inside Tham Luang Nang Non, Thailand’s longest cave, during a hike June 23. The cave's 6-mile-long labyrinth of chambers and passageways stretch all the way into neighboring Myanmar.
It’s believed the coach often took the teammates of the Wild Boar youth soccer team into the cave's main entrance in Khun Nam Nang Non Forest Park for fun excursions after practice.
But as the group ventured deeper into the cave that Saturday afternoon, the sky opened up and it began to rain. The downpour sent floodwater rushing into the mouth of the cave and cut off their exit route. The group forged ahead until finding a dry, raised slope where they remained stranded in total darkness for days.
After they didn’t return from their hike, Thai officials launched an extensive search-and-rescue operation involving well over 1,000 people, including specialists drafted from various nations such as Australia, China, Japan, the United Kingdom and the United States.
Persistent rain initially impeded efforts to locate the group. But two British divers found all 13 alive July 2 in an area a couple miles from the cave’s main entrance.
A team of Royal Thai Navy members, a doctor and a nurse stayed with the group, giving them high-powered protein drinks and medical assessments, while rescuers worked on a plan to get them out as safely and quickly as possible. They had to fight against mother nature to pump out floodwater and divert water flows amid Thailand's wet monsoon season.
The death of a former member of the Royal Thai Navy volunteering for the rescue effort also hindered progress and shook rescuers last week. Saman Gunan lost consciousness underwater during an overnight operation delivering extra air tanks along a treacherous route divers take to get to the trapped soccer team.
He could not be revived and was confirmed dead in the early morning hours of July 6.
Gunan, 38, formerly served in the Royal Thai Navy’s Underwater Demolition Assault Unit, colloquially known as the Thai Navy SEALs. His death was the first and only fatality in the operation to rescue the group and underscored the dangers of navigating through the cave underwater, even for those who have experience.
"We were very sad, and we felt like the whole world crashed," Gov. Narongsak told ABC News during Wednesday's interview. "But after we talked together, we said that we have to do everything, we have to go the point where we can bring out the kids."
International dive teams evacuated the boys four at a time over a period of three days this week, racing against time and an impending monsoon rainstorm that threatened to inundate the cave again. The coach was the last to be evacuated.
Nineteen divers entered the cave complex during every rescue mission, with one to two divers guiding each of the boys out with tethers through a winding, partially submerged series of caverns and corridors. The first leg of the days-long mission took 11 hours to complete on Sunday, while the second on Monday and third on Tuesday each took about nine hours, according to Narongsak.
Thai Prime Minister Prayuth Chan-ocha, the country’s military ruler, told reporters that the boys were given anti-anxiety medication before they were evacuated to help with the rescue mission.
Maj. Charles Hodges, the mission commander in charge of U.S. operations supporting the Thai-led search-and-rescue operation, told ABC News they questioned whether all of the boys would make it out of the cave alive.
"We knew this was extremely risky with a low probability of success," Hodges told ABC News chief anchor George Stephanopoulos in an interview Wednesday on "Good Morning America."
"I’m incredibly impressed with the way that it worked out but at the same time, candidly, I was thinking that it would be much worse results."
Upon emerging from the cave on stretchers, the boys and their coach were whisked away in ambulances to Chiangrai Prachanukroh Hospital in Chiang Rai province, where they remain quarantined as they recover from a variety of minor ailments, Thai officials said.
Parents and family members are allowed to visit but must stay more than 6 feet away. The boys and their coach will be physically reunified with loved after they are no longer quarantined in about a week or so, according to Narongsak.
The boys will serve as monks for a short time after they are released from the hospital, Narongsak told ABC News.
As a whole, "everybody is doing well," according to Thongchai Lertwilairatanapong, a public health inspector.
"No one has any serious infections," Thongchai said at a news conference Wednesday. "Everybody can now rest and do daily activities."
Gov. Narongsak said most of the boys were hungry and couldn't wait to be able to eat their favorite foods.
But the thing they all wanted most? To watch the World Cup.
ABC News' Adrienne Bankert, Brandon Baur, Joohee Cho, Matt Foster, Ben Gittleson, Hugo Leenhardt, James Longman, Kelly McCarthy, Matt McGarry, Gamay Palacios, Kirit Radia, Rex Sakamoto, Scott Shulman, Mike Trew, Anthony Trotter, Sohel Uddin, Marcus Wilford, Karson Yiu and Robert Zepeda contributed to this report.