Joy and relief have greeted the rescue of 12 boys and their football coach from flooded caves in northern Thailand after divers completed a daring operation to bring them out.
Seventeen days after they got trapped underground, the last five members of the group emerged on Tuesday.
Their plight and the complex three-day-long operation to free them gripped the world's attention.
Celebrations have swept the South East Asian nation and further afield.
There were cheers around the Tham Luang cave system in the country's Chiang Rai province as a rescue operation involving dozens of divers and hundreds of other rescue workers came to an end on Tuesday evening.
At the house just below the mountains where the men who run the Wild Boars football team meet, there was laughter, shouts and cheers - and people shook hands in a very un-Thai way, says BBC Jonathan Head.
In the nearby city of Chiang Rai, the news was greeted by the honking of car horns while people gathered outside the hospital - where all those rescued from the caves were taken for treatment - broke into applause.
On social media, Thais showed their feelings about the rescuers by using hashtags including #Heroes and #Thankyou.
Offers of hospitality for the boys, the coach and their rescuers have come in from international football clubs including Manchester United and Benfica.
How did the drama unfold?
The group was cut off on 23 June after heavy rains flooded their way back out of Tham Luang.
Aged between about 11 and 17, the members of the Wild Boars football team had entered the cave system during an excursion with their coach.
They were found by British divers last week, huddled in darkness on a ledge.
Elation at the discovery of all 13 members of the group alive quickly turned to concern as it emerged just how difficult it would be to rescue boys who could not swim and had been weakened by their time underground.
The complex, three-day operation saw four boys emerge on Sunday, four on Monday, and the final four boys plus their coach on Tuesday. All were immediately taken to hospital, but they are said to be in reasonable condition given their ordeal.
Confirming the completion of the rescue operation, the Thai Navy Seals Facebook page announced: "We are not sure if this is a miracle, science, or what. All the 13 Wild Boars are now out of the cave."
What next for the boys?
The first eight boys to be rescued - on Sunday and Monday - are still in hospital but said to be in good mental and physical health, and have now been joined by the four boys and the 25-year-old coach who were rescued on Tuesday.
X-rays and blood tests have been ordered, and they will remain under observation in hospital for at least seven days.
Their parents have been allowed to see them through a glass window at the hospital, but they are being quarantined.
Drinking contaminated water in the cave or being exposed to bird or bat droppings could lead to dangerous infections, experts say.
The boys lost weight during their time in the caves and are keen to eat. They are said to have requested a favourite pork dish, bread and chocolate, but solid food will have to be reintroduced slowly to prevent any digestive upset.
They will also need to wear sunglasses for a few days until their eyes readjust to the brighter light.
Offers of hospitality for the football team have come in from around the world:
- Global football body Fifa offered the 12 young footballers tickets for Sunday's World Cup final in Moscow, but they are too weak to travel.
- Portuguese club Benfica has invited the boys and their coach an all-expenses-paid week at its training academy.
- Manchester United - the English club several of the boys support - has offered them the chance to attend a game.
- England football players preparing for a World Cup semi-final with Croatia - including Manchester City defender Kyle Walker - are sending football kit to the boys after one of them was pictured wearing an England shirt inside the caves.
How were they rescued?
A team of 90 expert divers - 40 from Thailand and 50 from overseas - worked in the Tham Luang caves.
They guided the boys and their coach through darkness and submerged passageways towards the mouth of the cave system.
Getting to and from the trapped group was an exhausting round trip, even for experienced divers.
The process included a mixture of walking, wading, climbing and diving along guide ropes.
Wearing full-face masks, which are easier for novice divers than traditional respirators, each boy was accompanied by two divers, who also carried his air supply.
The toughest part was about halfway out at a section named "T-Junction", which was so tight that the divers had to take off their air tanks to get through.
Beyond that a cavern - called Chamber 3 - was turned into a forward base for the divers.
There the boys could rest before making the last, easier walk out to the entrance. They were then taken to hospital in Chiang Rai.
The last of the rescue team - three Thai Navy Seals and a doctor - emerged from the cave complex some hours after the last member of the trapped group was released.
Who are the boys and their coach?
Details have emerged of members of the team and their coach.
Captain Duganpet Promtep, 13, is described as a motivator and highly respected by his teammates. He had apparently been scouted by several Thai professional clubs.
Myanmar-born Adul Sam-on, 14, speaks several languages, and was the only team member to be able to communicate with British divers when they were first discovered.
It was 17-year-old Peerapat Sompiangjai's birthday when the group became trapped in the cave. The snacks the boys brought with them to celebrate are likely to have helped them survive their ordeal.
Assistant coach Ekapol Chantawong, 25, was said to be the weakest of the group when they were found, as he had reportedly refused to eat any of the food and gave it instead to the boys.