After an extraordinary rescue effort, all 12 boys and their soccer coach have been freed from a flooded cave in northern Thailand 17 days after they were trapped underground.

The group, a soccer team, got stuck deep inside the cave on June 23, after they went exploring after a practice and heavy rains caused flooding that blocked their exit.

The boys, ages 11 to 16, and their 25-year-old assistant coach became stranded about 2.5 miles inside the cave.

The third phase of the high-risk rescue operation for the boys and their coach happened quickly on Tuesday, CBS News reported. Hours after Thai officials confirmed that 19 divers had entered the cave in Chiang Rai province to bring out the last four boys and their coach, several of them were brought out on stretchers.

The plight of the 13 and the non-stop efforts to free them have gripped people around the world.

The first eight boys to be rescued, on Sunday and Monday, are said to be in good mental and physical health, the BBC reported.

The group was found last week huddled in darkness on a ledge and cut off from the outside world for nine days. The race then began to get them out before the weather deteriorated even further.

The boys who were evacuated Sunday and Monday have undergone X-rays and blood tests, noted the BBC. They will remain under observation in the hospital for at least a week. Two boys are said to be suffering from pneumonia or lung issues.

Who do you think would win the Presidency?

By completing the poll, you agree to receive emails from LifeZette, occasional offers from our partners and that you've read and agree to our privacy policy and legal statement.

The Thai Navy SEAL divers and the doctor who looked after the boys and their coach deep inside the cave must also be extracted to safety, said the BBC.

Related: Elon Musk Floats ‘Kid-Sized Submarine’ Idea for Final Thai Cave Rescues

One diver, Saman Gunan, tragically died on Friday when he ran out of oxygen.

Deirdre Reilly is a senior editor with LifeZette. Follow her on Twitter.