Thai navy SEALs who rescued the last boys and their coach who were trapped in a cave for more than 2 weeks almost didn't make it out

Rescuers who had gone in to save the last members of the Thai soccer team who had been trapped inside a cave for more than two weeks almost didn’t make it out.

Officials told ABC News the main pump that had been clearing floodwater from the cave’s chambers failed shortly after the final group of boys had been evacuated, leaving rescuers scrambling to haul out of the cave before all three chambers filled with water.

At about 9:30 p.m. local time, authorities held a press conference in which they confirmed that everybody was out and celebrated “mission accomplished.”

Rescuers who had gone in to save the last members of the Thai soccer team who had been trapped inside a cave for more than two weeks almost didn’t make it out.

Military officials involved in the operation told ABC News that after the last four boys and their coach were safely removed from the cave, members of the rescue team who were still inside noticed the waters were quickly rising.

The officials said the main pump that had been clearing floodwater from the cave’s chambers failed shortly after the final set of boys had been removed from the cave, leaving rescue divers, support teams, and medics little time to haul out of the cave before all three chambers filled with water.

Dozens of military personnel and civilians scrambled to leave the cave site before it flooded, leaving behind hundreds of air tanks belonging to the Thai navy, and other equipment that had been donated by the king of Thailand, the officials added.

The Thai navy SEAL Facebook page confirmed that at 9:30 p.m. local time, four of their members who had been involved in the boys’ rescue made it out safely.

By Tuesday evening, all 12 boys and their 25-year-old coach had been rescued, after surviving 17 days inside the flooded cave in northern Thailand. At least 19 divers were involved in the rescue mission to bring the last four boys and their coach to safety, ending a three-day rescue operation.

The third day saw the rescues run quicker and more smoothly than the days prior. The total turnaround for the final five was about 8 hours, 30 minutes.

At about 9:30 p.m. local time, authorities held a press conference in which they confirmed that everybody was out of the cave.