BANGKOK (Reuters) - “Hooyah! Hooyah!” Thailand’s junta chief, Prayuth Chan-ocha, was greeted with a rousing cheer when he inspected the operation to rescue 12 boys and their soccer coach from a flooded cave this week.

Thailand's Prime Minister Prayuth Chan-ocha gestures with acting Chiang Rai province governor Narongsak Osatanakorn during a meeting at the Tham Luang cave complex where schoolboys and their soccer coach are trapped inside in Chiang Rai, Thailand, July 9, 2018. Picture taken July 9, 2018. Thailand Government House/Handout via REUTERS

Thailand’s elite navy SEAL unit, hundreds of military personnel and foreign rescuers took part in the gripping, 17-day mission to save the boys trapped in the flooded Tham Luang cave in the northern province of Chiang Rai, and the navy’s morale-boosting “Hooyah” became a rallying cry for the mission.

The rescue, which ended on Tuesday with all 13 brought out safely, has been greeted with joy around the world, and at home it has, for now at least, united in a glow of goodwill a country divided by politics for years.

The success of the military-led operation could help Prayuth, who, as army chief, launched a 2014 coup that ousted a civilian government, burnish his image in the approach to a general election that some Thais hope will see the austere military veteran emerge as chief of a new civilian government.

The happy ending to the rescue could not have come at a better time.

The efficiency of the operation stands in contrast to the slow pace of reforms, which the junta promised when it took power. Opinion polls this year showed the prime minister’s popularity had dropped from a year earlier.

“It does help his popularity,” said Kan Yuenyong, head of the independent Siam Intelligence Unit think-tank, said of Prayuth, 64, who also met relatives of the boys when he visited the cave on Monday, hours after a second group of them had been brought out safely.

“Once this many soldiers come out to help, people view the army as a reliable unit. People still view Prayuth as a soldier.”

Prayuth, who has repeatedly delayed a general election he first promised for 2015, has come under pressure in recent months to hold the vote.

Anti-government protesters have rallied intermittently since the beginning of the year, even though such gatherings are officially banned, including some of the biggest demonstrations since the junta took power.

The election is due to be held by May next year.

Kan compared the cave rescue to a 2011 flood disaster that killed more than 900 people.

Then also the military waded in, at times chest-deep, to rescue villagers and deliver aid, a clear illustration of decisive action in a country where the average civilian official rarely inspires adulation.

“We lack civilian specialists so when there is a crisis in this country, we turn to the army,” Kan said.

‘WITH HEART’

Defence ministry spokesman Kongcheep Tantravanich said about 2,000 military personnel were involved in the cave mission, and he brushed aside any suggestion anyone was even thinking about a popularity boost.

“It is about love, generosity and the harmony of the Thai people ... and the efforts of all parties who wanted to overcome a natural disaster,” Kongcheep said.

“This is not about the military’s popularity. Soldiers did this with heart.”

The Thai armed forces portray themselves as the ultimate defender of the monarchy and many coups have been launched in the name of the king.

The monarchy’s presence was visible throughout the rescue and officials involved in the mission repeatedly praised the help given by King Maha Vajiralongkorn, 65, who sent kitchen trucks and staff to help feed rescuers.

The palace also donated lights and other equipment.

“Such an operation could not have been achieved unless there is the unity of effort exerted by all in a disciplined manner,” the king said in a July 4 letter.

Prayuth enjoys significant popularity in Bangkok, where middle-class voters are wary of the opposition loyal to former populist premier Thaksin Shinawatra, who is despised by the military-dominated establishment.

Thaksin, from the northern city of Chiang Mai, has traditionally won votes in poorer communities in the northeast and north, like the one the boys come from, where the rescue will inevitably be viewed as a plus for the government.

“This is a success for this government plain and simple,” said Sao Pancharoen, 58, a volunteer from Chiang Rai.

Despite the success, the military government is unlikely to try to take advantage of the good mood to bring forward the election, in which it hopes Thaksin’s influence will finally be overcome.

“I don’t think they would move forward the general election just because of this cave victory. They have their schedule,” Kan said.