All 12 boys and their football coach trapped for more than two weeks deep inside a flooded Thai cave have been rescued.
The news from the Thai Navy SEAL unit means a successful end to a perilous mission that has gripped the world.
"The 12 Wild Boars and coach have emerged from the cave and they are safe," the Thai Navy SEAL unit said on its official Facebook page.
The "Wild Boars" team and their coach became trapped on 23 June while exploring the cave complex in the northern province of Chiang Rai after training and a rainy season downpour flooded the tunnels.
British divers found the 13, hungry and huddled in darkness on a muddy bank in a partly flooded chamber several kilometres inside the complex, on Monday of last week.
After pondering for days how to get the 13 out, a rescue operation began on Sunday when four of the boys were brought out tethered to rescue divers.
Another four were rescued yesterday and the last four boys and the coach were brought out today.
Four SEAL team divers - including a doctor - who stayed with the group emerged after the boys later in the evening.
Celebrations will be tinged with sadness over the loss of a former Thai navy diver who died last Friday while on a re-supply mission inside the cave in support of the rescue.
Chief of the rescue mission Narongsak Osottanakorn addressed reporters at the end of the 17-day mission, arriving at a media centre to a round of applause.
He confirmed that a medic and all Navy SEAL divers involved in the rescue mission had also left the cave safely.
"Nobody thought we could do it. It was a world first," he said. "It was Mission Possible for Team Thailand.
"The heroes this time are people all over the world," he added, referring to the multinational team that assisted in the operation.
"This mission was successful because we had power. The power of love. Everybody sent it to the 13."
Officials said details of the rescue operation would be revealed tomorrow.
The eight boys who were rescued on Sunday and yesterday are said to be in good health in hospital.
"At this moment (there are) no worrisome conditions, everyone is safe," a health ministry spokesperson said of the boys currently being treated in hospital.
Two of the boys had suspected lung infections but the four boys from the first group rescued were all walking around their hospital rooms.
The boys had a good appetite but were mainly being given bland, easily digestible foods. However, doctors later relented after some of the boys asked for bread with chocolate topping.
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 cheered the rescue operation, including at the Mae Sai Prasitsart school where six of the trapped boys are students.
"I am very happy about those who already made it out and I think everyone will be out today," said Waranchit Karnkaew, 14, who also said the football-mad boys had been closely following games at the World Cup in Russia before they were trapped.
"I want to take my friends to lunch and we will play football together," he told Reuters.
Football governing body, FIFA, has invited the boys to the World Cup final in Moscow on Sunday. This seems less likely now given the need for the boys to undergo further tests.
However, they have also received an offer from Manchester United to visit Old Trafford in the forthcoming season.
#MUFC is relieved to learn that the 12 footballers and their coach trapped in a cave in Thailand are now safe. Our thoughts and prayers are with those affected.— Manchester United (@ManUtd) July 10, 2018
We would love to welcome the team from Wild Boars Football Club and their rescuers to Old Trafford this coming season. pic.twitter.com/5CGMoD1Msq
The plight of the boys and their coach has drawn international attention since they became trapped when they went into the cave after football training on 23 June.
Divers, engineers, medics and others have flown in from around the world to assist.
Technology billionaire Elon Musk went into the cave yesterday and left the rescue team with a "kid-sized" submarine his company SpaceX had built, Thailand's interior Minister Anupong Paochinda said.
Video from Elon Musk shows rescuers wading through water in the Thai cave where five people remain trapped pic.twitter.com/z9CbiKy7HY— RTÉ News (@rtenews) July 10, 2018
Mr Musk said on Twitter: "Just returned from Cave 3. Mini-sub is ready if needed. It is made of rocket parts & named Wild Boar after kids' soccer team. Leaving here in case it may be useful in the future."
Just returned from Cave 3. Mini-sub is ready if needed. It is made of rocket parts & named Wild Boar after kids’ soccer team. Leaving here in case it may be useful in the future. Thailand is so beautiful. pic.twitter.com/EHNh8ydaTT— Elon Musk (@elonmusk) July 9, 2018
Prime Minister Prayuth Chan-ocha visited the cave to inspect the operation and was quoted by Mr Narongsak as saying he did not want to see this kind of incident happen again on Thai soil.