Image caption Saman Gunan lost consciousness on his way out of the flooded cave

A former Thai navy diver has died while taking part in efforts to rescue 12 boys and their football coach trapped in a flooded cave in Thailand.

Petty Officer Saman Gunan lost consciousness on his way out of the Tham Luang cave complex, where he had been delivering air tanks.

The boys have been trapped for nearly two weeks in a chamber in the cave.

They ventured in while the cave was dry but were caught out by a sudden deluge of rain, which flooded the system.

The group was found by British rescue divers after 10 days in the cave, perched on a rock shelf in a small chamber about 4km (2.5 miles) from the cave mouth.

Teams of Thai and international divers have since supplied them with food, oxygen and medical attention, but there are mounting concerns about the oxygen level in the chamber, which officials said had fallen to 15%. The usual level is 21%.

On the surface, a huge military and civilian rescue operation is racing against the clock to bring the boys to safety. Heavy monsoon rains are expected on Sunday, threatening further flooding.

Officials had initially considered leaving the boys in the chamber to wait out the rainy season - which could have seen them trapped there for up to four months.

But Thailand's Navy Seal commander suggested on Thursday that the divers may now have little choice but to attempt a daring emergency rescue - fraught with danger for the boys, who are aged 11 to 16 and some of whom cannot swim.

"At first, we thought the children could stay for a long time... but now things have changed, we have a limited time," Rear Admiral Apakorn Yookongkaew said.

A death in the cave

The death of Saman - a highly trained diver - on Thursday underscored the danger of moving from the chamber to mouth of the cave, and raised serious doubts about the safety of bringing the boys out through the cramped, flooded passageways.

The diver died after losing consciousness in one of the passageways, said Passakorn Boonyaluck, deputy governor of the Chiang Rai region, where the cave is situated.

"His job was to deliver oxygen. He did not have enough on his way back," Mr Passakorn said.

He said that Saman's dive partner tried to revive him but could not, and his body was brought out of the cave.

Saman, who was reportedly 38, had left the navy but returned to aid in the rescue operation. Said to be an avid runner and cyclist, he was part of the massive rescue operation launched after the group became stranded in the Tham Luang cave.

Officials said his funeral would be sponsored by the Thai king.

The search operation would go on, said Rear Adm Arpakorn. "I can guarantee that we will not panic, we will not stop our mission, we will not let the sacrifice of our friend go to waste," he said.

About 1,000 people are involved in the rescue operation, including navy divers, military personnel and civilian volunteers.

A lack of oxygen

Authorities say there are concerns about falling oxygen levels in the chamber where the boys and their coach are trapped.

Oxygen was being depleted by the large number of people working inside the cave network, said the Chiang Rai Governor, Narongsak Osotthanakorn.

Authorities are now working to get a 5km (3 mile) cable into the cave to supply the group with air. They are also trying to feed a fibre optic cable through to the group, to connect them to their families for the first time in nearly two weeks.

What are the rescue options?

The boys are being regularly supplied with food and medical care, but there are grave concerns over heavy rainfall forecast for Sunday.

Image caption Bill Whitehouse from the British Cave Rescue Council explains how the boys and their coach might be rescued

Authorities are trying to work out how best to bring the group to safety, with officials stressing they do not intend to take any risks with the boys' safety.

The military has been pumping water out of the cave but if it cannot hold the water level down, it will be left a stark reality: teaching the boys to use diving equipment and bringing them via a route which has already cost one trained diver his life.

Some local groups are searching in the hills for unknown entrances to the cave system, but none has yet been found.

If a rescue attempt fails, leaving the boys to wait out the rain brings with it another danger: that the sinkholes and streams in the hills above could flood the chamber completely.

Diver's death a blow to morale

Sophie Long in Chiang Rai

Rescue operation leaders here say most of those involved have been trained to work in high risk environments, and to deal with eventualities like this.

They say the death of Saman won't impact on their mission. But there is a different atmosphere today in the makeshift village that's evolved at the cave's entrance, and the death of a former navy Seal highlights just how dangerous the route out of the cave remains.

It is unlikely the boys will be told about the death. One of the prime concerns here is to keep them not just physically but mentally strong.

Today, the priority is to connect the fibre optic cable that will allow the boys to speak to their families. It is hoped it will be a vital boost for the young boys, after two long weeks underground.