Divers pulling the 12 boys and their soccer coach from the cave were in a race against time, with the threat of rains making an already difficult rescue even more urgent.

Mr. Narongsak, commander of the rescue operation, said it could take days to recover the full team. The boys and their coach are being brought out one at a time by 13 foreign cave divers and five Thai Navy SEAL divers, Mr. Narongsak said.

He said the boys had been preparing for days to come out through long, flooded passageways that are challenging even for the most skilled cave divers, who must navigate openings so narrow that only one person can go through at a time. Each boy will have two divers trying to bring him out.

Further complicating the operation is that some of the boys do not know how to swim, said divers participating in the rescue effort.

Ambulances and helicopters are standing by to transport them to a hospital for medical treatment.

“Everyone knows exactly what they have to do, because any confusion in there would be really bad,” Mr. Narongsak told a packed news conference.

He said this was the best chance to bring out the boys safely.

“We believe there are no days when we have been readier than today,” Mr. Narongsak said. “If we don’t do the rescue on the day when we are readiest, we might lose the opportunity to carry out this mission.”

Mr. Narongsak announced that the rescue had begun after officials had cleared the area outside the cave of journalists.