Thailand’s King Bhumibol Adulyadej and Queen Sirikit in 1977 attend a symbolic mass cremation ceremony for Thai soldiers and civilians killed by communist insurgents over a one-year period. (Neal Ulevich/AP)

King Bhumibol Adulyadej of Thailand, the world’s longest-reigning monarch, a strong U.S. ally and a national unity symbol who acted as tiebreaker during sometimes-bloody confrontations between his country’s military leaders and democracy advocates, died Oct. 13 in Bangkok. He was 88.

The king had long suffered from lung infections, liver problems and other medical issues. Thailand’s royal palace announced the death but gave no specific cause.

His frail health was closely watched in a country marked by frequent coup attempts and changes of prime minister, and his death was expected to plunge the nation into further distress. His only son, Crown Prince Vajiralongkorn, a career military officer, is his heir apparent.

Though his formal powers were limited, King Bhumibol in effect stood above the law, parliament, courts and other civil and religious authorities for the past seven decades. Foreigners often viewed his celebrity as bordering on cultlike. Among Thais he enjoyed a reputation as the very model of a virtuous Buddhist leader, even a near-deity.

At crisis points in Thailand’s turbulent political history, a nod from him one way or the other was often enough to turn the tide. He helped exile a ruling junta in 1973 and bring in a civilian prime minister. But he was widely viewed as backing the military’s overthrow of a civilian government in 2006.

After World War II, U.S. policymakers viewed Thailand as a front-line against communist influence in Southeast Asia. Starting in the late 1960s, the king played a role securing an alliance that helped transform his agriculture-based country into a major recipient of Cold War military and economic aid from the United States.

Thailand became an important base for U.S. military forces during the Vietnam War and a bulwark against political crises in neighboring Cambodia and Laos. In recent years, Thailand has become a strategic partner in anti-terrorism operations, with the palace remaining an influential background force in that relationship.

Absolute monarchies around the world had long been on the wane when Bhumibol — also known as Rama IX — was proclaimed king in 1946. He and his royalist supporters revived the authority of the crown through alliances with a succession of anti-communist military rulers.

By official accounts, however, King Bhumibol distanced himself from daily politics. In a rare interview, the king told the BBC in 1979 that the crown tried to “keep in the middle, neutral, in peaceful coexistence with everybody. We could be crushed by both sides, but we are impartial. One day it will be very handy to have someone impartial.”

That image was reinforced by unremittingly adoring news coverage in Thailand and rigid enforcement of lèse-majesté laws that criminalized real or perceived criticism of the monarchy. Several books about the king, even one he proposed, were banned without explanation.

Many Thais found the king’s manner deeply endearing. He did not stand on ceremony when talking to peasants, and he expressed genuine desire to help the most vulnerable. The king often used his authority to slice through bureaucracy and distribute aid quickly during national crises, or to help the poor and marginalized by dispensing mercy during court appearances.

He used the royal purse to fund development projects that affected nearly every Thai village, often visiting a site himself, camera in hand. Projects included clinics, schools and, in a more controversial undertaking, grand-scale dams named after him and his family members that uprooted entire communities. His charitable contributions were far-reaching, as well.

His picture hung everywhere, in homes, schools and places of business. His actions and words were often described by commoners in magical terms. Cabinet ministers and farmers alike knelt in his presence.

Once viewed as an elitist institution, the crown repositioned itself during the king’s reign as essential to the values and needs of the peasant class. But the king’s words and actions suggested that at key points in history he had mixed feelings about liberal democracy.

He was to many Thais a hero for standing up to the ruling generals in 1973 after they used tanks and machine guns against crowds of young people demonstrating for a new constitution. More than 70 protesters were killed. At one point, the king acted against his bodyguards’ advice and turned his palace grounds into a shelter from the army. The ruling officers soon left the country.

But he was shaken when communists abolished the monarchy of neighboring Laos after their takeover there in 1975. The next year, King Bhumibol supported a military crackdown that led to the deaths of at least 46 student protesters and the injury of hundreds more at Thammasat University in Bangkok. Some were hanged from trees.

One of his most brilliant and sensitive public roles came in 1992, when he calmed a crisis in which soldiers began massacring democracy demonstrators on the streets of Bangkok. The king was credited with helping halt confrontations between the prime minister, Gen. Suchinda Kraprayoon, and opposition politician Chamlong Srimuang, who led the street protests.

Television broadcast images of the two leaders kneeling before him, the king speaking of their moral and patriotic duty to the nation.

Paul M. Handley, a journalist whose biography of King Bhumibol, “The King Never Smiles” (2006), was banned in Thailand, said in an interview with The Washington Post that the king reduced “the entire episode to a personal feud between two ambitious men” and stopped it.

The king, Handley wrote, “avoided alienating the demonstrators, his loyal subjects, and condemning the military, the men who protected him. He also skirted the real issues of the constitution.”

Jazz fanatic and bon vivant

Bhumibol Adulyadej, whose name means “strength of the land, incomparable power,” was the ninth king of the Chakri dynasty, which was established in 1782.

His ancestors included King Mongkut (1804-1868), whom Yul Brynner portrayed as an autocrat in the Rodgers and Hammerstein musical “The King and I,” and his grandfather King Chulalongkorn (1853-1910), a revered figure credited with modernizing government and society.

Bhumibol was born in Cambridge, Mass., on Dec. 5, 1927, making him the only king from any country born in the United States. His father, Prince Mahidol, was studying at Harvard Medical School at the time and died two years later of kidney and liver ailments. His mother was a Thai commoner.

In 1932, a military-civilian group staged a successful and bloodless organized revolt against the absolute monarchy, instituting a constitutional government. Bhumibol, his mother and his older brother, Ananda, lived in comfortable exile in Switzerland into the 1940s as Europe and Thailand endured war and political upheavals.

Bhumibol studied at the University of Lausanne but mostly cultivated a reputation as a race-car enthusiast (a road accident in 1948 severely injured his right eye), jazz fanatic and bon vivant.

A saxophonist and clarinetist, he led a small jazz ensemble and wrote dance songs, among them “Blue Night,” which the New Yorker magazine dubbed “Bhumibol’s beguine” when it was featured in the 1950 Broadway revue “Michael Todd’s Peep Show.”

The Thai military emerged from World War II in disgrace for having allied the country with Japan in 1941. The Free Thai Movement, which gained national prestige by fighting the Japanese, helped bring Bhumibol and the family back after the war, hoping the monarchy would unite the country.

The plan suffered a traumatic reversal when Ananda was found dead on June 9, 1946, at the royal palace in Bangkok near one of the pistols he collected. He was lying on his back in bed, with a bullet in his head.

Speculation ranged from suicide to political murder to accidental fratricide, and the death was never fully explained. The matter was officially resolved in 1954 when the chief of police pushed through the execution of three pages of a former senior palace official for conspiring to kill Ananda.

Coming to power

Bhumibol was declared king after his brother’s death, but his official coronation did not take place until 1950, after his marriage to a distant cousin, Princess Sirikit. Besides his wife, survivors include their son and three daughters.

The generals reasserted control of politics shortly after the war. They shunted King Bhumibol to the side during his early years on the throne, but his stature rose dramatically after he gave support to the 1957 coup that installed Field Marshal Sarit Thanarat as prime minister. The king became an active participant in the Thai military’s long effort to win U.S. funding during the Cold War.

He was the subject of glowing public relations campaigns orchestrated by the U.S. Information Service and the Agency for International Development. Books were published extolling the king’s wisdom.

In a round of state visits in the early 1960s, the king met Elvis Presley and Walt Disney and sat in with Benny Goodman’s jazz combo. The king and queen won dazzling media acclaim and were feted as a glamorous couple comparable to John and Jacqueline Kennedy.

Although the king’s personal habits, often bordering on the ascetic, were viewed by many Thais as beyond reproach, his family life was at times rocky. In 1972, his eldest daughter, Ubolratana Rajakanya, shocked Thai society when she gave up her title to marry an American; they later divorced. Prince Vajiralongkorn acquired a reputation for personal indulgence that left many Thais concerned over how the monarchy would fare if he eventually took the throne.

Considered closer to the king in temperament and popularity is his second daughter, Princess Sirindhorn. She has been mentioned as a possible successor in recent years, but any attempt to elevate her to the throne was viewed as likely to trigger a succession crisis.

Under Thai law, the reigning king has the sole right to amend a 1924 Palace Law of Succession that provides for a male heir.

In his latter years, the king remained a player in politics, in large part through his senior adviser, former prime minister Prem Tinsulanonda. Prem was widely believed to have helped orchestrate the 2006 coup against the elected prime minister, Thaksin Shinawatra, a populist, authoritarian tycoon whose family business dealings led to protests dominated by middle-class Thais.

In 2014, during the military coup against the civilian government led by Thaksin’s sister, Prime Minister Yingluck Shinawatra, the new junta declared that it had received an endorsement by the ailing king.

Amid the political machinations, King Bhumibol remained in the popular imagination a stabilizing and commanding figure. In 2002, he wrote what became one of the best-selling books in Thai history, a biography of his favorite dog, Tongdaeng. In the tale, about a humble, adoring pet whom he protects, some saw a social parable.

He wrote, “She would always sit lower than the King; even when he pulls her up to embrace her, Tongdaeng would lower herself down on the floor, her ears in a respectful drooping position, as if she would say, ‘I don’t dare.’ ”