The Thai navy said Friday that a former navy SEAL died while diving as part of an effort to rescue 12 boys and their soccer coach trapped deep inside a cave in northern Thailand.

SEAL commander Rear Adm. Arpakorn Yukongkaew said at a press conference that the diver, Samarn Kunan, 38, fell unconscious due to lack of air on Thursday night while diving his way back from his mission to place air canisters in the cave.

(Divers head toward a cave complex in northern Thailand on July 3, where 12 boys and their soccer coach who were found alive)

A fellow diver who was with him in the cave tried to revive with CPR but was unsuccessful, the commander added. The former navy SEAL was pronounced dead in the early hours of Friday.

It was the first fatality during the ongoing rescue effort.

Thai and foreign rescuers have been grappling with how to extract the group safely from deep inside the flooded cave complex while they battle against time, as heavy rain is expected in the coming weeks and months.

But the cave has narrow passages and flooded areas that would require the boys to swim or dive. Divers are familiarizing them with diving equipment, but the death underscores the difficulties that lie ahead for the effort to bring the group out of the cave safely.

Arpakorn, the SEAL commander, said that despite the fatality, the rescue mission will continue nonstop.

"We will move on with our mission to help the boys trapped inside the cave," he said, adding that SEAL members are trained to handle any risks.

The commander also said the rescue team had thought the boys would be able to stay in the cave for some time, but that the situation has changed, signaling that rescue workers have a limited amount of time before extracting them. He did not elaborate on the situation, however.

Chiang Rai Deputy Gov. Passakorn Boonyaluk told reporters on Friday that the boys and coach show signs of fatigue as they have remained trapped inside the cave for such a long time already.

The 12 boys, aged between 11 and 16, and their 25-year-old male coach went missing after entering the Tham Luang Nang Non cave in Chiang Rai Province on June 23.

They were found deep inside the cave by two British rescue divers late Monday amid a frantic search effort by hundreds of rescuers and support personnel.

Prime Minister Prayut Chan-ocha on Friday expressed his condolences to the family of the former navy SEAL and honored his sacrifice.

His funeral will be held under the patronage of King Maha Vajiralongkorn, according to the deputy governor.

Meanwhile, international soccer body FIFA, in a message of "support and solace," said it would invite the 12 boys and their coach to the 2018 World Cup final, scheduled for July 15 in Moscow, if they are extracted in time and their health allows them to travel.

"We hope that, in some way, our words of support may help bring them a little peace and courage in these difficult moments of uncertainly and concern," FIFA president Gianni Infantino said in a letter to Thai soccer authorities that was posted on the website of the Football Association of Thailand.

Related coverage:

Rescuers grappling with how to extract 13 trapped in Thai cave

Boys found in Thai cave say they are in good health