King Bhumibol Adulyadej's death at the age of 88 has come amidst dark times for Thailand. The world's longest reigning monarch, Bhumibol was a unifying figure in a deeply divided country still reeling from a military coup in 2014 and economic turmoil that has only intensified this week as the monarch's health declined.
His expected successor, Crown Prince Vajiralongkorn, is a deeply divisive figure, known for his lavish spending, womanising and erratic behaviour which has included throwing a birthday party for his pet dog and once using his private jet to block the plane carrying the Japanese prime minister on the tarmac in Bangkok.
Both the Thai public and political elites have always preferred Vajiralongkorn's sister, Sirindhorn. In 1974 the Thai constitution was amended to allow Sirindhorn to succeed her father, but only if he explicitly decreed it. As far as is known, at the time of his death on Thursday (13 October), he had not.
But questions of succession aside, the death of Bhumibol could not come at a worse time for Thailand. In 2014, the democratically elected government was overthrown in a military coup. In 2016, the military has entrenched its position by holding a referendum on extending its powers, which it subsequently won.
Meanwhile, Thailand has been hit by a number of terrorist attacks including a bomb blast at Hua Hin in August 2016 and at a Bangkok shrine in 2015 that killed 20 people. The spate of attacks risk damaging Thailand's tourism industry, on which its fragile economy relies.
"In a way, the sovereign, Rama IX was the embodiment of a unifying figure that Thailand needed. I think he is irreplaceable. With his passing the divide that we have seen over the past decade will become more entrenched and harder to rectify," said Paul Chambers, director of research at the Institute of Southeast Asian Affairs in Chiang Mai.
Divisions are nothing new in a country that has seen dozens of military coups over the past century, but the modern period of instability began when the Thai military overthrew Thaksin Shinawatra in 2006, and then in 2007 banned his party, Thai Rak Thai. A new incarnation of the party won elections in 2007, and Thaksin returned to the country only to flee again in 2008 when his ex-wife was found guilty of corruption and jailed.
Opposition protesters began mass demonstrations in September 2008 calling for the resignation of Prime Minister Samak Sundaraveg, and by November had Bangkok airport surrounded. His party was ousted and its leader banned from politics for five years, which lead to new protests, this time by supporters of Thaksin.
From March to May 2010, tens of thousands of Thaksin supporters – wearing red shirts – took to the streets of Bangkok in protests that became increasingly violent. By 2011, Thaksin's sister, Yingluck Shinawatra, had taken power at the head of a new 'red shirt'-supported government.
At the end of 2013, tens of thousands of opposition 'yellow shirt' protesters joined demonstrations, forcing Yingluck to call new elections for the following year. But then in May 2014, the military staged a coup and ousted Yingluck and her party from power. The move was supported by King Bhumibol.
In recent years the king's health has made him increasingly absent from the political realm, allowing opposing factions within the Thai military to exert more influence. One of the most powerful factions is the Queen's Guard, loyal to Bhumibol's wife, Queen Sirikit, herself absent from politics since she suffered a stroke in 2012.
It remains to be seen how quickly Vajiralongkorn will seek to take over the throne from his father, but for the prince and his power base, acting fast will be key. Although Vajiralongkorn is the heir apparent, there has not been a transition of power since 1946 and powerful sections of the military may try to block his coronation.
The mourning period for Thailand's much-revered king is also likely to add to political and economic instability in Thailand. News of the king's declining health last week hit the country's stock market as investors dumped shares and holdings in the baht currency. Thailand has trying times ahead.