Elon Musk said it was "great news" that the soccer team that has been trapped in caves in Thailand had been rescued on Tuesday.

His tweet comes after he posted photos from inside the Tham Luang Cave in Chiang Rai.

Musk had previously said he wanted to help with the rescue mission in any way he could.

The Thai boys soccer team and their coach spent more than two weeks in the cave before being rescued.

SEE ALSO: Meet the 25-year-old coach of the Thai soccer team who was trapped in a cave for 17 days

Billionaire tech entrepreneur Elon Musk applauded the rescue of a Thai boys soccer team and their coach after they were saved from a flooded cave in northern Thailand.

"Great news that they made it out safely. Congratulations to an outstanding rescue team!" he tweeted Tuesday morning. "The team did extremely well. Sub will be useful in future operations."

It comes after he posted photos from inside the Tham Luang Cave in Chiang Rai on the final day of rescue operations.

He shared images and video as four members of the soccer team, as well as their coach, were still trapped inside.

He also shared video on Instagram, showing people wearing headlamps wading through water and guided by ropes.

Musk had been posting about wanting to help the rescue efforts in Thailand in days prior, and he traveled to the Southeast Asian country as the mission was underway.

"Elon and the team visited the tunnel last night to assess the conditions and get further feedback on the mini-submarine, in case it was used as a backup option," SpaceX told Business Insider on Tuesday.

Musk had said that his mini submarine could be put to use during the rescue mission if necessary.

Divers, however, rescued the remaining boys and their 25-year-old coach without the help of Musk's submarine.

The 12-boy soccer team and their coach were rescued after surviving 17 days inside the flooded cave in northern Thailand.

The final boy and the team's coach were brought out of the cave at 6:50 p.m. local time on Tuesday.

The Thai navy celebrated the completed mission on Facebook with their slogan "Hooyah!", adding that it was a "miraculous" rescue.