“He has left behind a great nation, a grieving and grateful nation,” Professor Thitinan said. “There are detractors and critics who might argue that the monarchy has impeded democratic development over the past decade, but in the broader, overarching perspective, Thailand would not be where it is today without this monarchy and this monarch.”

Thailand has been divided for years between poor farmers mainly in the rural north and more prosperous urban residents centered in Bangkok. At the same time, Muslims have been fighting a low-level insurgency in the far south for more than a decade, seeking independence from the central government.

The military has staged two coups over the past 10 years to oust populist governments that favored the rural poor, first the government led by a billionaire businessman, Thaksin Shinawatra, and later the government of his sister, Yingluck.

Part of the rationale for the current government’s remaining in power was to ensure a smooth transition after the expected death of King Bhumibol.

The announcement of the king’s passing came about three hours after the official time of death, 3:52 p.m. He died at Siriraj Hospital in Bangkok, where he had been confined for most of the past few years. He had a number of health problems, including kidney failure, and in his final days was on a ventilator.

On Wednesday rumors of his death sent the Thai stock market plunging nearly 7 percent before it recovered somewhat later that day to a loss of 2.5 percent.

“Even though the team of doctors tried their best, his illness hasn’t improved and he declined accordingly until 13 Oct. 2016,” the palace said Thursday in its announcement.