Image copyright Reuters Image caption King Bhumibol is seen by Thais as a pillar of stability

King Bhumibol Adulyadej's pivotal role in modern Thailand's development tends to obscure the fact that when he acceded to the throne in 1946, the status of the monarchy was not secure, and the young king himself was unprepared to take on the job.

Until 1932 Thailand had been ruled by an absolute monarchy, with the king exercising power over the judiciary, the appointment of government officials and over state policy.

The idea of kingship had been developed over centuries from the Buddhist concept of a dhammaraja, a just king acting in accordance with the 10 dhamma virtues like integrity and self-restraint, and the Hindu concept of an all-powerful god-king.

But the pressures of the modern, globalised world intruded in 1932 when a group of soldiers and intellectuals overthrew the absolute monarchy and imposed a constitution limiting the powers of King Prajadhipok, on the throne at the time.

Unable to accept these limitations he abdicated in 1935 and lived the rest of his life in exile.

A young monarch

Bhumibol's elder brother, Ananda Mahidol, was next in line, but their mother insisted they stay away from the volatile political climate in Thailand and they were brought up in Switzerland.

As a result there was no sitting king until the family returned after World War Two in 1945 and it was not clear then what kind of monarchy might be re-established.

Image copyright AFP Image caption King Bhumibol inherited his throne in 1946, at the age of 18

Following the still unexplained shooting to death of King Ananda on 9 June 1946, that task fell to the 18 year-old Bhumibol.

Thailand was divided then between progressive politicians and ambitious military men who preferred a weaker monarchy, or perhaps no monarchy at all, and members of the royal aristocracy who were determined to rebuild a political system with the monarchy at its heart.

The royalists relied on the young Bhumibol for this plan, and over the next 40 years it succeeded.

Royal roles

Until the mid 1950s the king's position was still too insecure for him to challenge the then-military strongman Phibul Songkram, who had also ruled during the war. He was not even allowed to travel freely outside Bangkok.

Image copyright Reuters Image caption Until 1932, Thailand had been ruled by an absolute monarchy, with the king exercising power over the judiciary

But the other royal princes helped build up his public profile by emphasising his role as the protector of the Buddhist faith, restoring royal rituals like the replacement of sacred cloths at the most important temples, or presiding over the annual ploughing ceremony in the main royal square in Bangkok.

Thai society is still a deeply religious and spiritual one, and those royal roles have been central to upholding King Bhumibol's image as a man who embodies dhamma virtues.

The king proved skilled at behaving in a manner which reinforced that image. Today the sacred aspect of the monarchy is an important source of its popularity.

From the mid-1950s on, the king travelled widely, and took an active interest in rural development projects.

How effective his interventions really were is difficult to gauge, given the swirl of royalist propaganda, but they certainly established him as a caring ruler who was working hard for his people.

Image caption King Bhumibol would often visit rural areas, in contrast to the apparent uncaring attitude of corrupt local government officials

His visits to rural areas, where he would often chat to the farmers prostrated in front of him, contrasted with the apparently uncaring attitude of corrupt local government officials.

Anti-communist figure

Today the monarch is expected to be involved in the country's development, and substantial resources have been devoted to promoting King Bhumibol's philosophy of a "sufficiency economy" - a focus on balanced development that stresses environmental and social responsibilities as much as conventional measures of economic progress.

From the mid 1960s, when central government authority was challenged in the countryside by a communist rebellion, the king's visits helped rebuff the influence of the insurgents.

King Bhumibol became an essential figure in the fight by the Thai military and its US-backers against communism, although his role became more controversial in the savage anti-leftist coup of 1976, in which dozens of students were brutally killed by the security forces and royal-backed militias, and thousands forced to flee to seek sanctuary with the Communist Party.

But the legacy of this anti-communist role is a monarchy which is still seen as central to upholding the authority of the state throughout the country.

Image copyright Reuters Image caption People across Thailand show their reverence for their king with multiple pictures of the monarch hung on their walls

Throughout his reign King Bhumibol worked with a series of military-dominated administrations, prompting accusations that he was more comfortable with authoritarian than democratically-elected regimes.

Certainly he established close relationships with three long-standing military rulers, Sarit Thanarat 1957-63, Thanom Kittikachorn 1963-73 and Prem Tinsulanonda 1980-89, giving them the legitimacy of royal backing in return for the armed forces' unwavering support for the monarchy. The king also enjoyed handling and using military weapons, and often wore his own military uniform.

Royalists explain this, and the king's inevitable endorsement of every coup d'etat, as him accepting his limited constitutional powers - that he could not play an overt political role, and had to go along with whichever regime prevailed in Thailand.

The role of mediator

Critics, though, believe he shared the disdain for elected politicians held by many of Thailand's traditional elite, as money-grubbing, classless opportunists.

In interviews the king referred to politics as something unseemly with which he did not want to be associated.

But the deep polarisation of Thai society at the end of his reign, and the widespread belief that the palace had taken sides against the successful electoral machine of former Prime Minister Thaksin Shinawatra, gave rise to a perception of the monarchy as hostile to untrammelled democracy.

One other side of Bhumibol's role was often talked about during his reign, as a mediator at times of crisis. Officially he could not intervene. But on two occasions, in 1973 and 1992, when bloody clashes between troops and protestors had taken place on the streets of Bangkok, he is credited with defusing the situation and allowing a compromise to be settled.

In 1973 he decided to allow protesting students to shelter inside his palace, undermining then dictator Thanom and forcing him into exile.

This allowed the formation of Thailand's first democratic government since the 1940s, although this brief period ended tragically in the violence and repression of 1976.

Image copyright AFP Image caption Numerous students were killed and others injured during violent demonstrations in 1976 at Thammasat University

In 1992 the king mediated again, summoning a military-backed prime minister and the leader of the protest movement, and allowing video of them prostrating themselves before him to be broadcast. Following this, Thailand had enjoyed its longest period of democracy, up to the coup of 2006.

There is debate about how decisive the king's role was in these crises, but the incidents allowed him to be portrayed as the ultimate arbiter of disputes.

Influential, but only sparingly

Another "intervention" in April 2006 saw the king ordering the country's top courts to rule on whether an election won by Thaksin Shinawatra should be annulled.

Image copyright Reuters Image caption Crowds gather whenever the king's convoy travels, and many sport yellow - symbolising royalty - on their birthdays

Ostensibly he was rebutting calls from anti-Thaksin protesters to appoint a prime minister himself, something he said was beyond his power. But the judges took the hint, and annulled the election on the grounds of fairly minor irregularities, which then led to the September coup of that year.

Royalists in Thailand often compare the powers of the monarch to those described by the historian Walter Bagehot for British kings and queens: the right to be consulted, the right to encourage and the right to warn.

But King Bhumibol, viewed as semi-divine by much of the population, clearly had more than that; what former Prime Minister Anand Panyarachun has described as his "reserve power or moral authority", something that can be hugely influential, but only if used sparingly.

The strictures of the lèse-majesté law make any open discussion of King Bhumibol's role and legacy impossible inside Thailand.

Thailand's lese majeste laws explained

No true measure of his popularity or influence is possible in this environment. But outside the country arguments have been made that challenge the official view of a wise, benevolent and adored king who held his country together at times of crises.

Image copyright Reuters Image caption Thailand's modern monarchy is one built almost entirely around the king

Some of these argue that the king was a central player in undermining democracy, others that he was more of a pawn used by conservative forces.

One point on which critics and supporters do agree is that the project started in 1946 to restore the status of the monarchy in Thailand succeeded largely because it was centred on the young king.

Whatever the truth behind the gushing praise for his personality and achievements, he played all the various roles ascribed to him, of the caring but restrained king, the renaissance king keen on arts, music and handicrafts, the religious king steeped in Buddhist ritual, extremely well.

Thailand's modern monarchy is one built almost entirely around one man. And that will make it difficult to sustain after his death.