Sultan Hassanal Bolkiah may be trying to better his Islamic credentials as Brunei's economy is weakening.

Brunei's imposition of harsh sharia laws, including death by stoning for gay sex and adultery, is a bid by the country's ruler to boost support among conservatives and highlights a steady drift away from the West, observers say.

The tough punishments, which also include amputation of a hand and foot for theft, will come into force Wednesday when a new penal code is fully implemented after years of delays.

The decision to move ahead with the laws has sparked a global outcry, with the United Nations branding them "cruel and inhumane" and actor George Clooney leading calls for Brunei-owned hotels to be boycotted.

By making his country the first in East or Southeast Asia to introduce a sharia penal code on a national level, analysts believe all-powerful Sultan Hassanal Bolkiah is seeking to burnish his Islamic credentials among conservative supporters at a time the economy is weakening.

Brunei, a resource-rich former British protectorate on Borneo island with a population of about 400,000, was plunged into recession in recent years as oil prices plummeted and its crude reserves declined.

"Brunei is becoming Southeast Asia's Saudi Arabia," Bridget Welsh, a Southeast Asia expert from John Cabot University, told AFP.

"The regime has increasingly been relying on religious legitimacy, appealing to a conservative Islamic ideology. The weakening economy in Brunei as well as concerns about possible erosion of support underscore this increasing reliance on religion."

Shift to China

The Muslim-majority nation's implementation of punishments that may scare off Western businesses also signals a shift towards investment from China, which typically refrains from criticising trading partners on human rights, observers said.

As in many other parts of Asia, Chinese companies are investing huge sums in the absolute monarchy, part of an infrastructure drive aimed at extending Beijing's economic and geopolitical clout.

Initiatives include a multi-billion-dollar oil refinery -- Brunei's biggest ever foreign investment project -- a dam and a highway. Xi Jinping visited the country in November last year, the first trip by a Chinese president in 13 years.

Experts say it is hard to gauge the level of public backing for sharia law in Brunei, as most citizens would not publicly voice criticism of the sultan.

But it is believed to have substantial support among the country's Muslim ethnic Malays, who make up some 70 percent of the population. Those who speak publicly generally welcome it.

"I'm proud, because implementing the law feels like it solidifies the Islamic identity of Brunei," Muhammad Antoni, a 27-year-old oil and gas company worker, told AFP.

Others were irritated at the calls for a boycott of nine Brunei-owned hotels in Europe and the United States.

"Regarding celebrities calling for a boycott, it's not their place," said Haziah Zainal, a 36-year-old civil servant. "These actions seem ignorant as they have not even been here to experience what it's like."

There was some unease online, however, where people can comment more freely.

"This worries me so much for Brunei's economy," one user posted on social media platform Reddit, adding that it would mean "losing more business overseas".

Global alarm

In reality, it is not yet clear if the toughest punishment -- death by stoning -- will be implemented.

Brunei has long had capital punishment, and any execution should be carried out by hanging. But the last known instance of someone being put to death in the country was in 1957, according to Matthew Wolfe of human rights group The Brunei Project.

While condemning the new penal code, Amnesty International said the country was "abolitionist in practice" when it comes to the death penalty.

The burden of proof is high before someone can be sentenced to death by stoning. An accused person must either confess to the offence, or it must be witnessed by at least four people who have to then testify.

The sultan, the world's second-longest ruling monarch, has weathered controversies before -- the monarchy was deeply embarrassed over revelations the ruler's brother Jefri allegedly embezzled billions of dollars -- and is unlikely to back down.

In a weekend statement, the government defended its right to introduce the new penal code, saying that sharia law "aims to educate, respect and protect the legitimate rights of all individuals".