The rescue operation garnered support from celebrities as varied as United States President Donald Trump, football star Lionel Messi and Technology billionaire Elon Musk.
After more than two weeks trapped inside a cave complex in Thailand, all 12 boys and their football coach have finally been rescued.
The last three members of the youth football team and their coach were pulled out of the cave on Tuesday.
"All 12 'Wild Boars' and coach have been extracted from the cave," the Thai navy SEALs said in a Facebook post.
"All are safe," they added and signed off with "Hooyah".
The last four Thai navy divers, including a doctor, who had been with the boys emerged safe from the cave later.
A crack team of foreign divers and Thai Navy SEALS has been guiding the boys out through nearly 4 km (2.5 miles) of sometimes submerged, pitch-dark channels.
The boys, aged from 11 to 16, and their coach, ventured into the Tham Luang cave in mountainous northern Thailand on June 23 after football practice and got trapped when heavy rains caused flooding that forced them to take shelter on a muddy ledge.
After they were found on July 2, officials cautioned it could take some time to get them out, but with heavy rain forecast to hit the region authorities decided to act.
The initial efforts at finding them dissipated as authorities struggled to devise a safe plan to get them out.
The 10-km long Tham Luang cave complex is relatively unexplored and contains narrow, dark passages.
Before deciding to dive out, rescuers weighed three other options to extract the boys, such as drilling holes into the mountain, pumping the water out or waiting months until monsoon rains ended and they could walk out, with the rescue chief at one point dubbing the efforts to save them "Mission Impossible".
The escape route was a challenge even for experts -- a former Thai Navy SEAL diver died when he ran out of oxygen in a flooded area of the cave on Friday while trying to prepare the escape route.
Many of the boys could not even swim and none of them had diving experience, so the rescuers trained them how to use a mask and breathe underwater via an oxygen tank.
How the boys were rescued
Graphic: Rajesh Karkera/Rediff.com
Thai Prime Minister Prayut Chan-O-Cha revealed today the boys had been given some medication to help them remain calm.
"It was a minor tranquiliser to prevent (the) boys from being anxious," Prayut told reporters.
The eight boys brought out on Sunday and Monday were in good health overall and some asked for chocolate bread for breakfast, officials said.
Two of the boys had suspected lung infections but the four boys from the first group rescued were all walking around their hospital beds.
Minister and deputy chief of mission of the Royal Thai Embassy in India, Apirat Sugondhabhirom expressed his gratitude to India for offering its assistance in the rescue operations of the members of a Wild Boars football team stranded in a flooded cave in northern Thailand.
They are still being quarantined from their parents because of the risk of infection and would likely be kept in hospital for a week to undergo tests, officials said.
People across Thailand, and the world, have cheered the rescue operation.
The rescue operation garnered support from celebrities as varied as United States President Donald Trump, football star Lionel Messi and Technology billionaire Elon Musk.
"On behalf of the United States, congratulations to the Thai Navy SEALs and all on the successful rescue of the 12 boys and their coach from the treacherous cave in Thailand," Trump tweeted. "Such a beautiful moment - all freed, great job!"
Manchester United also invited the "Wild Boars", as well as those involved in the rescue, to travel to England and visit the club.
"Our thoughts and prayers are with those affected. We would love to welcome the team from Wild Boars Football Club and their rescuers to Old Trafford this coming season," the club said in tweet.
Musk also visited the cave and offered up a specially built kid-sized submarine which the team turned down as it was 'not practical'.
How the Thai cave rescue unfolded
June 23: The 12 boys and coach were trapped inside the cave.
June 25: Thai Royal Navy SEAL divers reach the cave and find handprints on the wall, but pause the search again because of flooding. Officials start pumping out water.
July 2: Two British divers found the missing boys and their coach.
July 6: A former Thai navy SEAL aiding the rescue effort dies due to lack of oxygen during the operation.
July 8: Divers rescued four of the boys out through tight passages and flooded caverns.
July 9: Divers take four more boys to safety during the second day of the rescue operation.
July 10: On the third day of the rescue op, divers bring out the remaining four boys and their coach, ending an 18-day ordeal.