MAE SAI, Thailand — It began as a misadventure by 12 boys and their soccer coach in a flood-prone northern Thai cave, which soon seemed destined to end in tragedy.

It turned into a nearly three-week-long story of survival, international collaboration and triumph over the impossible — one that was avidly embraced and followed live across the world.

A team of cave divers rescued the last of the boys and their coach on Tuesday from deep inside the warren of underground passages near Thailand’s border with Myanmar, one of Southeast Asia’s more remote regions.

One by one, the divers brought the final four members of the Wild Boars team and their coach out of the flooded Tham Luang Cave.