Thailand's King Bhumibol Adulyadej has died after a long illness, the palace has announced, ending a remarkable seven-decade reign and leaving a divided people bereft of a towering and rare figure of unity.
"His Majesty has passed away at Siriraj Hospital peacefully," the palace said. He was 88.
Thai Prime Minister Prayuth Chan-ocha said that an heir to King Bhumibol has been designated since 1972 and that the government would inform parliament of the choice.
The PM did not identify the heir but it is widely expected to be Crown Prince Maha Vajiralongkorn
He has taken a more prominent part in royal ceremonial and public appearances in recent years, but he does not command the same level of devotion as his father.
For the majority of the country's 68 million people, the king was a pillar of stability in rapidly changing times -Thailand embraced industrialisation during his reign but also saw its parliamentary democracy punctuated by ten military coups, the most recent in May 2014.
King Bhumibol, who ascended the throne on 9 June 1946, was seen as a force for unity, and there have long been concerns that the political tensions that have riven Thailand over the past decade could worsen after his death.
That may be less likely under the regime of the leader ofthe most recent coup, Prime Minister Prayuth Chan-ocha. The former general has held a tight grip on power since toppling the remnants of Thailand's last democratic government in 2014.
Thailand has been divided for years between the royalist establishment and the red-shirted supporters of exiled former prime minister Thaksin Shinawatra, who was ousted in a 2006 coup.
The king had been in poor health for some time, and has spent most of the past six years in Bangkok's Siriraj hospital.
King Bhumibol was re-admitted in May 2015 and was last seen in public in January, when he spent several hours visiting his Bangkok palace.
The Royal Household Bureau in its statement did not give a reason for the king's death. The king been treated for a respiratory infection, a build up of fluid surrounding the brain and a swollen lung in the past few months.
Born in 1927 in Cambridge, Massachusetts, where his father, Prince Mahidol, was studying medicine, King Bhumibol spent much of his early life abroad, first in the United States and then in Switzerland.
He became king after the still unexplained gunshot death of his elder brother, 20-year-old King Ananda Mahidol who was also known as Rama VIII. King Bhumibol returned to Thailand for good four years later to be crowned King Rama IX.
The saxophone-playing King Bhumibol was a celebrity visitor to foreign capitals in the early years of his reign with Queen Sirikit, a distant cousin whom he married in 1950 shortly before his coronation.
The king who acceded to the throne as a young man cut a quite different figure from the sombre monarch into which he matured.
Over the years, he was groomed as a national figurehead through civic and ceremonial duties. He undertook a stint in the Buddhist monkhood and developed a keen interest in the environment and rural development.
Though officially above politics, he first started to speak out on political issues in the 1960s against the backdrop of a creeping communist insurgency.
In 1973, he intervened personally after bloodshed in Bangkok when students demonstrated against military rule. He nominated a new prime minister, diffusing the political tension.
Although backing the students then, as a social conservative King Bhumibol was worried about the threat to public order inherent in any people's movement, and three years later he intervened on the side of the military after another bloody putsch.
The king's image as a political truce-maker peaked after bloody clashes in 1992 between pro-democracy protesters and the army. He summoned the protagonists, a former general leading the protests and an army-chief-turned-prime minister, and with the two prostrate before him, ordered them to desist.
His intervention led to the subsequent collapse of military rule.
Often referred to as "Por", the Thai word for father, many Thais looked to him for moral guidance and saw him as a neutral arbiter during their nation's darkest hours.
"We are in the middle," the king said in a 1979 BBC documentary. "One day it would be very handy to have somebody impartial, because if you have in a country only groups or political parties which will have their own interest at heart,what about those who don't have power?"
The king retreated from active political intervention after the events of 1992 in favour of influence wielded through a network of ageing generals, judges and bureaucrats on his Privy Council of advisers who helped oversee what some academics view as a "managed democracy", in which the military remained prominent.
The army avoided direct intervention in politics from 1992 until the 2006 coup against Mr Thaksin who the military said was corrupt and disloyal to the monarch.
Thailand's monarchy is one of the world's richest, although the value of its assets and the wealth of family members have never been made public.
The king was seen as semi-divine by many ordinary Thais, an image bolstered by Thailand's education and legal systems.
"The King shall be enthroned in a position of revered worship and shall not be violated," states the constitution.
The country now faces an uncertain future. The vast majority of Thais have lived only under King Bhumibol.
In a statement, President Michael D Higgins expressed condolences to the people of Thailand on behalf of the people of Ireland.
"With his passing, the world has lost both its longest reigning head of state and a statesman deeply committed to peace and peaceful co-existence."