Thailand's King Bhumibol Adulyadej has died at the age of 88 after a long illness, the palace announced Thursday, ending a remarkable seven-decade reign and leaving a divided people bereft of a towering and rare figure of unity.

"Although the team of doctors treated him to the best of their ability, his condition deteriorated," the Royal Household Bureau said in a statement.

"At 15:52 (0852 GMT) he died at Siriraj Hospital peacefully."

Shortly before 7 pm local time, all Thai television stations switched to a special announcement that began with black and white photographs of the king.

READ: Thai's Parliament to convene for special meeting tonight

PHOTO: King Bhumibol: ln loving memory (1927-2016)

A man, dressed in a black suit and shirt, read out the same statement that was published minutes earlier.

The king's death plunges Thailand into a deeply uncertain future.

Most Thais have known no other monarch and Bhumibol has been a unifying figure in an otherwise deeply polarised nation.

His 64-year-old son, Crown Prince Maha Vajiralongkorn, is his named successor.

Bhumibol's death is a major test for the country's generals, who seized power in 2014 vowing to restore stability after a decade of political chaos, a turbulent period exacerbated by the king's declining health as jostling elites competed for power.

The military has deep links with the palace and many inside the kingdom saw the putsch as a move to ensure generals could stamp down on any instability during succession.

It is difficult to overestimate how important Bhumibol has been to most of his subjects. Many of those gathered outside his hospital were dressed in pink in the belief that it would bring the king good luck, while others flooded social media with digital prayers.

- National devotion -

From cradle to grave they have been taught about his devotion to his people in newspapers, history books, school classes and nightly television broadcasts.

It is not unusual to see Thais moved to tears when they talk of a future without him.

Officially known as King Rama IX, he descended from the Chakri dynasty which came to power in Thailand in the late eighteenth century.

His subjects have had many years to get used to the prospect of no longer having Bhumibol -- their king has not been seen by the public for months and has suffered years of ill health.

On Sunday and Wednesday the palace released two unusually grave health statements, saying the monarch was on a ventilator, battling kidney problems and that his condition was "not stable".

But his passing will still be a huge shock to the nation.

Backed by an intense palace-driven personality cult, he is revered as a demigod by many, seen as a serene leader above the din of the kingdom's notoriously fractious political scene.

His reign spanned a remarkable era in which Thailand transformed itself from an impoverished, rural nation into one of the region’s most successful economies, dodging the civil wars and communist takeovers of its neighbours.

He built a reputation for criss-crossing the nation to visit the rural poor and sometimes intervened to quell key moments of political violence -- although other times he stayed silent and he approved most of the army's many coups during his reign.

- Criticism muted -

Any criticism or effective republican sentiment has been erased inside Thailand by a draconian lese majeste law, use of which has surged since the military’s latest takeover.

Vajiralongkorn is much less well known to Thais and has yet to attain his father’s widespread popularity. He spends much of his time overseas, especially in Germany, and is a keen pilot who flies his own Boeing 737.

In recent years, and especially since the 2014 coup, he has made more frequent public appearances inside Thailand and taken on a larger number of royal engagements.

He will inherit one of the world's richest monarchies.

During his reign Bhumibol, with his establishment allies, built up a multi-billion-dollar-empire spanning property, construction and banks under the banner of the Crown Property Bureau (CPB).

Analysts say the CBP's vast reserves allowed the crown to build a deep network among the Thai elite, helping insulate the king from the political pressures felt by monarchs who rely chiefly on state funding.

The palace’s announcement that the king was gravely ill sent shudders through the stock market and pushed the baht currency to a two-month low.

In a note to clients this week, risk consultancy firm BMI Research said the king's passing would likely create "more financial market volatility as well as a period of economic gridlock amid an extended official mourning period".