At first it seemed like the boys would never be found. Then, when they were finally discovered, came a warning that any rescue could take months.
But against all the odds, all 12 members of the Moo Pa (wild boar) soccer team, along with with their 25-year-old coach, have now been freed, Thai officials announced Tuesday, after spending 18 days trapped on a narrow shelf deep in a flooded network of caves in northern Thailand.
In three stages, starting on Sunday, divers ventured into the claustrophobic caverns to retrieve two boys at a time, giving them a full-face mask for oxygen and tying them with a rope. Each boy was accompanied by two divers, one holding the child and a second air tank, while another followed behind. The boys were also given anti-anxiety medication to prevent them from panicking as they were carried and pushed through narrow crevices.
They emerged two at a time, exhausted but alive and in remarkably good condition, according to officials. They will spend at least a week in hospital until the risk of infection has lifted. So far those treated have been described as in a good condition.
The team, roughly aged between 11 and 17, went missing after being trapped by rising waters in the Tham Luang Nang Non caves. The boys — who have nicknames such as Night, Titan, Tee, Nick, and Ake — were last seen when they went to explore the caves on June 23.
On July 2, to much jubilation from the boys' families, they were found by rescue workers – alive, but painfully thin.
In video footage that was viewed around the world, the two British divers who found them, Rick Stanton and John Volanthen, asked the group: "How many of you? 13? Brilliant."
"Tell him we’re hungry. I haven’t had anything to eat," one boy said.
The two divers were volunteers, just some of the 1,000 or so people who had been involved in the operation overall.
Andy Eavis, a spokesman for the British Caving Association told the Washington Post: "I said from the outset, if anybody is going to find these kids, it will be these two divers, who are arguably the best in the world.
"Compared to what Rick and John are normally doing, this is extremely easy diving, the only complication was the flow of the water."
Not only did divers have to navigate passages no more than 1.1-meters (3.6-feet) wide, in a hazardous roundtrip that lasted at least six hours, they had to dive against a strong current.
Some parts were so narrow, such as the so-called T-junction where two passages converge, divers had to remove their oxygen canisters from their back and swim with it held out in front of them.
Fortunately, despite fears that monsoon rains had raised water levels inside even further, long stretches of the passageways were passable on foot.
In total a team of 90 divers took part in the operation, including 40 from Thailand and 50 from other countries. One of them, Saman Gunan, a former Thai Navy diver, died on Friday after losing consciousness on his way out of the caves.
After the 12th boy was freed on Tuesday, volunteers spontaneously broke into song.
While the boys remained in the caves, three Thai Navy Seals and one medic had stayed with them to offer assistance and food. (These four rescue officials were still due to emerge from the cave at the time of publication.)
An Australian anaesthetist visited everyday and gave the boys medication to calm them before their arduous journey to the surface.
Thai authorities had also guarded the boys' privacy very closely. The rescue operation manager, Narongsak Osottanakorn, warned the assembled global media on Monday that any intrusion would not be tolerated, rebuking a reporter who used a drone to get an aerial shot of the cave site.
As world leaders sent their congratulations, the boys were set to be reunited in hospital in Chiang Rai.
Families of the boys cheered at the hospital as the final ambulances carried them in on Tuesday evening.
While doctors say they are doing well, the boys are yet to be evaluated by psychologists, who will be looking for signs of trauma, concerned about the long-term effects of the boys' ordeal.
It had been suggested that the boys would be invited to the World Cup final in Moscow on Sunday, but this was always unlikely given their frail physical states. FIFA will instead invite them to another event later on.
As a consolation, after seeing some of the boys wearing England football shirts, England and Spurs defender Kyle Walker tweeted that they will at least be getting some new swag.
Patrick Smith is a senior reporter for BuzzFeed News and is based in London.
Contact Patrick Smith at email@example.com.
Got a confidential tip? Submit it here.