After they were found on July 2, officials cautioned it could take some time to get them out, but authorities chose to act with heavy rains forecast to hit the region. For the past two weeks, they have spent nearly all of their time pumping water out of the cave.
Experts had anxious that the harrowing journey could make the boys panic, triggering an underwater accident.
A hint of setting sun and blue skies broke through the heavy clouds behind the caves as a helicopter whirred through the sky, carrying the last boys recovered to a hospital in nearby Chiang Rai.
"We have been informed by the Football Association of Thailand that due to medical reasons, the boys will not be in a position to travel to Moscow for the World Cup final".
Smiles and celebration after final boys and coach freed from Thai cave.
But faced with a forecast of more rain this week, experts warned that if a rescue mission were not executed quickly, the boys and their coach could be stranded in the cave for months more.
1 NEWS' Correspondent Kimberlee Downs from Chiang Rai, Thailand, following the successful completion of the rescue.
There was no immediate update on the health of the remaining five who emerged from the cave on Tuesday, but Thai Navy SEALS said they were "safe".
There are concerns they may have consumed contaminated water, while bird or bat droppings could cause infections.
Narongsak said the rescued boys had not been identified out of respect for the families whose sons were still trapped.
Pure Flix films managing partner Michael Scott said: "I see this as a major Hollywood film with A-list stars".
The submarine is named "Wild Boar" after the name of the football team.
Payap Maiming, who helped provide food and necessities to rescue workers and journalists, noted that fact. Six of the 12 boys on the soccer team attend her school.
Despite all the risks associated with the rescue, she says she never had any doubt that the boys would all make it out.
"Doctors have treated the boys, and now all of them are OK and cheerful and are talking normally, " said Jesada Chokedamrongsuk, permanent secretary of the Thai Ministry of Public Health. Above them, a bald eagle symbolizing the United States flaps its wings next to the face of Iron Man - a reference to "Mr. Elon Musk", who sent engineers from his companies Space X and Boring Co.to help with rescue efforts last week. Musk had proposed possible technological solutions for extracting the boys while they were trapped and travelled to Thailand this week.