To the casual observer, the country is calm and orderly. And reverential: Adorning a sweet-seller's stall in a buzzing market in Bangkok, Thailand's capital, are a dozen laminated pictures of the 88-year-old King Bhumibol Adulyadej — who, on the throne since 1946, is the world's longest-reigning monarch, indeed the only king most Thais have ever known.

During his reign, Thailand has become one of the richest big countries in Southeast Asia, a manufacturing hub and a magnet for tourists. Bhumibol's picture is everywhere, including in millions of homes. As for the ailing king himself, who lies in a hospital just opposite the vendor's stall, he has not been seen for months. The palace rarely breaks its silence. But in June and again this month, doctors said they had drained fluid from his brain.

Whether it comes in weeks or years, the king's death will be more than a milestone. It may set loose centrifugal forces that a coup in 2014 sought to contain, but one that seems destined in the long run only to aggravate.

Below the surface, Thailand is deeply fractured. The army-enforced calm accompanying the king's twilight is fragile. Not least of the problems is that his successor, the crown prince Maha Vajiralongkorn, is deeply unpopular. After Bhumibol's death the country, a critical ally of the U.S. in Southeast Asia, risks descending further into civil strife and economic dislocation, as an elite around the palace resists popular calls for a greater say in politics and a more equitable sharing of wealth. At that point, all bets about Thailand's stability and prosperity may be off.

When the junta ousted the elected government of Yingluck Shinawatra two years ago, it was the second army-backed coup in a decade. This time the army appears to be digging in. The junta, under the self-declared prime minister, Prayuth Chan-ocha, has forbidden politics and censored the press. Criticism of an illiberal draft constitution that the generals hope to ram through in a popular referendum on Aug. 7 is banned. Critics of the junta, including journalists, activists and a few politicians, have been hauled in for "attitude adjustment."

Notably, the junta has made draconian use of Thailand's law on lèse-majesté, which provides for long prison terms for anyone deemed to have spoken ill of the king, queen or heir-apparent. Facing growing anti-establishment sentiment in the provinces among people who feel that an urban alliance has conspired to disenfranchise them, the authorities have presided over a big rise in the law's use over the past decade, with imprisonments rising sharply after the 2014 coup.

More than 50 people spent some time in jail in June for lèse-majesté; they included Thais accused of defaming the royals in a student play, scribbling on toilet walls and speaking unguardedly in a taxi. Military courts have handed out staggering sentences: last year two Thais convicted of posting anti-monarchy messages on Facebook received jail terms of 28 and 30 years. Any Thai may report an instance of lèse-majesté, and the authorities invariably act. Hard-liners argue that even criticizing the law or the long sentences is an offense (though the king himself did so in 2005, complaining that: "If you say that the king cannot be criticized, it suggests that the king is not human.").

A big part of the generals' project is to eradicate any lingering influence of Thaksin Shinawatra, a populist politician (and elder brother of the ousted Yingluck) now in self-imposed exile, but who has been the biggest factor in politics for most of the past decade and a half. For all Thaksin's flaws, he recognized the plight of the less well-off and shaped a politics that appealed to them.

His first government introduced free health care and increased subsidies to rice farmers. That, in 2005, helped him become the first elected Thai prime minister to complete a term in office. Yet the business and political establishment around the royal court pushed back. Bangkok bigwigs warned that rural giveaways would bust the budget. They worried that he appeared to be setting up a network of patronage and economic power to rival their own. Their royal-sanctioned network was — and remains — huge, yet it is the chief obstacle to the modernization that Thailand needs for long-term stability.

The 63-year-old crown prince, Vajiralongkorn, is spoiled and demanding, and widely loathed. The elites worry that, when crowned, the prince might align himself with Thaksin's populist movement. That could grant Thaksinites access to the crown's wealth and lock the old elites out of power.

There is some talk that King Bhumibol might abdicate before he dies to help smooth the transition.