THAM LUANG CAVE, Thailand — The British diver John Volanthen was placing guide lines to try to get closer to 12 missing boys and their soccer coach trapped in a flooded cave network when he ran out of line himself, forcing him to the water’s surface.

There they were, all 13, staring at him through the light of his headlamp. After 10 days of efforts racing against monsoon rains and rising water in the cave, the search for the missing soccer team had finally succeeded.

If his line had been even 15 feet shorter, he would have turned back and not reached them on that dive Monday night. The group would have spent at least another night on its own in the pitch black, not knowing if a rescue would ever come.

“Literally, he finished his line, stuck the line reel in the mud, and they were looking down,” Vernon Unsworth, his friend and fellow cave explorer, said Tuesday.