Photo/IllutrationFormer Prime Minister Prem Tinsulanonda attends a charity function in Bangkok on Nov. 11, 2014. (AP file photo)

BANGKOK--Prem Tinsulanonda, one of Thailand's most influential political figures over four decades who served as army commander, prime minister and adviser to the royal palace, has died at age 98.

His death Sunday in a Bangkok hospital was announced by the government's Public Relations Department, confirming earlier unofficial reports in Thai media.

Prem was best noted for his longstanding devotion to the monarchy, especially the late King Bhumibol Adulyadej, who appointed him to his Privy Council immediately after he stepped down as prime minister, and named him head of that powerful advisory body in 1998. His close relationship with Bhumibol helped cement the military's ties with the palace, ensuring they were the country's two most powerful institutions.

Prem served as prime minister from 1980 to 1988. While most Thai army commanders came to the position through coups, Prem was elected by parliament though he never ran for office.

Critics questioned his devotion to democracy, and later accused him of encouraging, if not engineering, the 2006 coup that ousted elected Prime Minister Thaksin Shinawatra. He denied the charge, but his behind-the-scenes power-brokering underlined the influence he continued to hold in the military. Well-publicized annual pilgrimages to his Bangkok home to convey birthday greetings were undertaken by all army brass.

Prem appeared to be in vigorous health for his age until recently. He appeared frail at two most recent public appearances: voting in the March general election and the coronation of Bhumibol's son, King Maha Vajiralongkorn, earlier this month.

As prime minister himself, Prem weathered two attempted coups and was reportedly the target of assassination plots by his enemies in the army.

Junior officers pushed a reluctant Prem into taking the prime minister's job in 1980, when Thailand faced an ailing economy and perils on the border with Cambodia, which had been occupied by Vietnamese forces who had driven out the communist Khmer Rouge regime but also sent hundreds of thousands of refugees into Thailand. At the same time, Thailand had expanded ties with China and allies in the West, Japan and Southeast Asia.

At home, Prem relied on a general amnesty and other political means to prompt massive defections from the communist guerrilla movement.

Prem was born in the major southern fishing port of Songkhla on Aug. 26 1920. He attended the prestigious Chulachomklao Royal Military Academy in Bangkok and later U.S. Army schools. He began his military career in 1941 as a second lieutenant in a tank regiment.

He first achieved national prominence in 1974-77, when as army commander in the Thailand's poor rural northeast he stressed rural development and civic action instead of military might in a successful campaign against communist insurgents.

He was appointed deputy interior minister in 1977 and later army commander in chief and defense minister. He became prime minister in March 1980, after the resignation of Kriangsak Chomanand, another former military leader.

The border crisis with Cambodia eased over time, and Prem had the good luck to preside over the birth of the country's economic boom, which ended only with Asia's devastating 1997 financial crisis.

Prem showed little appetite for public political activity, and was dubbed by some academics as suffering from "reluctant ruler syndrome."

Without a party base of his own, his patchwork Cabinets of opportunistic politicians and technocrats were not models of good governance. As Thailand moved from crisis to prosperity, public sentiment for better, more democratic leadership also rose. Prem's aloof manner, bordering on arrogance, also earned him little popularity.