While Thailand holds its collective breath as rescuers attempt to save 12 boys and their soccer coach trapped in a cave in the northern province of Chiang Rai, the country’s ruling military junta has more reason than most to pray for a happy ending.

A successful rescue of the boys could give the junta – which seized power in a coup d’etat in May 2014 – a timely popularity boost as it comes under intense pressure to hold elections.

“Thai authorities are trying to use [the rescue] for political gain,” said Rangsiman Rome, a pro-democracy activist and leader of the Democracy Restoration Group. “Whoever saves the kids is going to be seen as a hero.”

Thailand’s monks run amok, but will junta’s crackdown answer its prayers?

The boys, aged between 11 and 16, and their 25-year-old coach entered the cave after practice on June 23 and became trapped by rising waters. They were missing until July 2, when they were found alive seeking refuge on a mud bank. The Thai Navy Seals shared on Facebook a video of the moment two British divers found the children, and since then has been sharing more videos and pictures of the rescue operation.

The stakes are high. At least one rescuer, a former Thai Navy seal, has died from lack of oxygen while trying to help the children. The divers are being lauded as heroes, and Chiang Rai governor Narongsak Osottanakorn has called the rescue “mission impossible”.

More than 1,000 people have been involved in the operation so far, including the Thai Navy Seals, and teams from various countries, including China, Laos, the United States and Britain. However, evacuating the children from the cave is proving more difficult than finding them; the route to safety is considered dangerous even for expert divers and some of the boys do not even know how to swim.

Since the start of the operation, Thai authorities, including members of the royal family, have expressed support for the rescue teams. Last Friday, Prime Minister Prayuth Chan-ocha flew to the area to visit the families and to reassure them about the efforts being made by the government. “His message to the families was very politicised,” said Rangsiman. “But I don’t think they will succeed [in improving their image]. People are going to differentiate between the soldiers who are participating in the rescue and the government.”

Nine rescues that give hope to the boys found in Thailand cave

In recent months, the junta has come under mounting pressure to hold elections. A vote has been promised for February 2019 but could be delayed until May. “There is enormous pressure [on the junta] to fulfil this endeavour … They must show the international community that they can get the boys out alive,” said Paul Chambers, an expert on the Thai military and politics at Naresuan University. “There are elections [approaching] and if there is a negative perception about Prayuth that comes around because of this, it is not going to be good for the junta,” he said.

A successful rescue might also improve the international perception of the junta. Even though British divers actually found the children and more experienced international teams might be better equipped to eventually free them, a positive image of “cooperation between the junta and Western countries” could serve the junta well, Chambers said.

Edoardo Siani, an anthropologist at Kyoto University, said there has been a “Buddhification” of the rescue operation. Locals think the cave is inhabited by the spirit of an old princess, and is considered a representation of the rural resistance to Bangkok’s centralised religion, as well as a symbol of the remaining power that local traditions still have in places like Chiang Rai.

What the Thai army took from Thaksin Shinawatra’s playbook

“They are delegitimising the local spirit cults and … presenting the rescue operation as a takeover of Buddhism over these superstitious beliefs,” said the scholar, referring to Buddhist ceremonies that were held in the cave to pray for the children.

Many are also praising Phra Khuva Boonchum, a local Buddhist monk who has been credited for stopping the rain when he prayed in the area on Saturday. The children were found two days later, as he predicted.

“In the political arena, it replicates the same model [as when] the military junta said that they needed to take over politics [in the 2014 coup] because people in the rural areas were not sophisticated enough,” he said. “The rescue operation has nothing to do with politics, but it does replicate the entire political model.”

Public opinion, including that of liberal intellectuals, supports the suspension of any law that might make the rescue operation more difficult, such as environmental preservation laws. “The entire [2014] coup d’etat was about suspending the law … and it is very interesting how this episode of the cave could spark some very liberal intellectuals to say that the law must be suspended,” Siani said.

If the level of the water rises again, the rescue could take up to four months, until the rainy season ends. “The less time it takes [to rescue the boys], the more the junta will gain public support,” said Chambers.