A daring rescue mission in the treacherous confines of a flooded cave in Thailand has saved the 12 boys and their soccer coach who were trapped deep within the labyrinth, ending an 18-day ordeal that claimed the life of an experienced volunteer diver and riveted people around the world.

Thailand’s Navy SEALs, who were central to the rescue effort, said on their Facebook page that the remaining four boys and their 25-year-old coach were all brought out safely Tuesday. Eight of the boys were rescued by a team of 18 Thai and international divers on Sunday and Monday.

“We are not sure if this is a miracle, a science, or what. All the thirteen Wild Boars are now out of the cave,” the SEALs said, referring to the name of the boys’ soccer team. “Everyone is safe.”

They said they were waiting for a medic and three SEALs who had stayed with the boys in their dark refuge deep inside the cave complex to come out.