Thailand's Royal Palace says King Bhumibol, the world's longest-reigning monarch, has died at age 88.
The palace said the king passed away peacefully on Thursday at Bangkok's Siriraj Hospital.
"Even though the board of doctors has closely monitored and treated him to the best of its abilities, the king's condition never improved," it said in a statement.
Hundreds of Thais have gathered outside the hospital since the palace announced on Sunday that the king's condition had become "unstable."
Prime Minister Prayuth Chan-ocha announced that Crown Prince Maha Vajiralongkorn would become the new monarch in accordance with the constitution. He said government officials will observe a one-year mourning period, and no government events would be held for one month.
"He is now in heaven and may be looking over Thai citizens from there," he said.
Bhumibol Adulyadej became king in 1946 and was revered in Thailand as a demigod. He anchored the Southeast Asian country through violent upheavals at home and communist revolutions next door with a blend of majesty and a common touch.
The once-vigorous king had withdrawn from public life over the last decade due to his ill health. He lived at the hospital and had been notably silent about the political upheaval that has shaken Thailand in recent years.
Hundreds of tearful mourners gathered Thursday outside the hospital, grasping photos of the king, chanting prayers and looking up at the building where he had been treated.
"There is no word to explain my feeling right now," Gaewkarn Fuangtong, a humanitarian worker, said in Bangkok's financial district.
"I lost one of the most important people in my life. I feel like I haven't done enough for him. I should have done more. I will do good, do better for his sake."
Bhumibol had suffered from a variety of ailments related to old age, including kidney and lung problems.
In a statement late Wednesday, the palace said his blood pressure had dropped, his liver and kidneys were not working properly and he was on a ventilator.
Because Bhumibol has been king since 1946, there is great concern about the succession. Crown Prince Vajiralongkorn, who returned home from Germany on Wednesday, has not earned the same respect as his father.