Note: This story contains a graphic image that may be disturbing to some readers.

In 2013, Ottawa's Algonquin College opened a satellite campus in Jazan, Saudi Arabia. The school probably expected to draw heat at home for opening a male-only school, and it did. What it wasn't bargaining on was having five headless bodies strung up on the streets of the city.

Saudi authorities had executed five Yemenis for murder, and put their corpses on display on a pole strung between two cranes as a warning to others. Standard practice in the desert kingdom.

Last year alone there were 151 executions in Saudi Arabia, the highest number in 20 years. About half died for non-violent offences, and about half were foreigners.

This year began on an even bloodier note, with 47 executions on Jan. 2, including that of a prominent Shia cleric who had spoken against the royal family.

"We've very clearly concluded that the situation has deteriorated significantly over the past year," says Alex Neve, secretary general of Amnesty International Canada.

Rooted in religion

In fact, Saudi Arabia puts fewer people to death than either China or Iran. But Saudi Arabia's grim tally attracts attention for three main reasons.

One is that many of those put to death are foreigners (mostly poor migrant workers); another is that it executes people for "crimes" (like adultery or even sorcery) that are not considered offences in other countries; and the third is that its punishments — beheading, whipping, crucifying and stoning — are so shocking to Western sensibilities.

These actions make it difficult for Western allies to defend the kingdom, particularly because similar punishments are often cited as part of the justification for waging war on groups like ISIS and the Taliban.

A photo that circulated on social media in Saudi Arabia shows five Yemenis who were beheaded for murder and then put on public display. (Twitter)

And yet Saudi Arabia also appears uniquely impervious to outside pressure to change its ways, which are rooted in religion.

"Saudi Arabia has always been a very difficult country to push human rights change in," says Neve. "It's very resistant to external pressure, and it's been ruthless in crushing internal reform efforts."

One of the West's leading experts on the country, Gregory Gause, the head of the international affairs department at Texas A&M University, agrees that the Saudis are not feeling the heat.

"The more power a country has in the international system, the less they have to worry about human rights reports," he says. "And the Saudis have leverage because of oil."

But Gause says there is one area where the Saudis are very touchy, and that may have influenced the methods it used in the recent mass execution.

"They're extremely sensitive to the comparison to the Islamic State. Not many of the 47 were beheaded. Most of them were stood up in front of firing squads," a decision, Gause says, that was "probably" influenced by a desire to differentiate the kingdom from the self-declared Islamic State.

The kingdom's only law book

The vagaries of the Saudi justice system, however, can be seen in any number of cases, including that of Ali Hussain Sibat, a Lebanese TV personality who had his own call-in show where he wore a turban and peered into a crystal ball.

Along with his psychic routine, he dispensed homely advice.

In 2008, Sibat visited Saudi Arabia on pilgrimage, and was unfortunate enough to be recognized by a member of Saudi Arabia's Committee for the Promotion of Virtue and the Prevention of Vice, known colloquially as the religious police. He was hauled before a sharia court and sentenced to death for "predicting the future."

No such crime exists in the Saudi criminal code, because there is no Saudi criminal code.

The ulama, the Saudi religious establishment, insists that no codified law is required because all that needs to be said about law and punishment can be found in the Qur'an and the Sunnah, the oral tenets of Islam that have been handed down over the centuries.

Consequently, Islamic court judges are free to improvise charges such as "predicting the future," "breaking allegiance with the ruler" or, in the case of the recently executed Shia cleric, "seeking foreign meddling."

Those charges are typically linked back to a broader category of offence that appears in the Qur'an.

In Sibat's case, it was "sorcery." What has happened to him since his death sentence is unknown, but Saudi Arabia continues to behead men and women, mostly foreigners, whom it accuses of casting spells and making magic potions.

Rule by fatwa

Islam has no established clergy, and yet senior religious figures can issue edicts or fatwas that have legal force in Saudi Arabia. Among them are about 700 qadis or religious justices who can decide individual cases.

Former U.S. president George Bush, shares a laugh with then Saudi Crown Prince, now King Salman while watching a traditional sword dance at a museum in Al Janadriyah, Saudi Arabia in 2008. (Susan Walsh/Associated Press)

These judges are known for their conservative world views. In 2008, for example, one of the most influential of these Saudi qadis issued a fatwa against Mickey Mouse, warning that mice and other rodents were "soldiers of Satan." Other Saudi fatwas ban Pokemon cards, Barbie dolls, marking Valentine's Day or bringing flowers to a sick person in hospital.

How rigorously a fatwa is enforced can depend on the personal religious authority of the man who issued it.

While the Al-Saud family holds the throne, it is the Al ash-Shaykh family that sits atop the kingdom's religious, and therefore judicial, hierarchy as grand muftis. They are the direct descendents of Muhammad ibn Abd al-Wahhab, who founded the kingdom's official creed of Wahhabi Islam in the 18th century.

Bonds of marriage and mutual interest have joined the two families together for 270 years. The ash-Shaykh family, more than the Sauds, are generally considered the true guardians of Saudi conservatism.

The last grand mufti, Abdul Aziz bin Abdullah bin Baz, issued a fatwa that the sun rotated around the Earth, deeming it "lawful to kill whoever claims that the sun is static." Bin Baz only changed his mind in 1985 after Saudi Prince Sultan bin Salman went into space on the shuttle Discovery and returned to Earth to say that he had seen the planet rotating.

The prince also succeeded in persuading Bin Baz to drop his long-standing insistence that the world was flat.

Reform a long way off

Still, it would be a mistake to imagine that removing the current establishment would lead to a more liberal regime, says Gause.

"The central parts of Saudi Arabia are extremely conservative, socially. And if you had a true democratic system, I think you'd have a lot of people who are more socially conservative than the royal family coming to power."

The practices that shock Westerners, including the public beheadings and the public display of bodies all seem likely to continue. Advocates of more democracy will remain targets.

"I think that the current regime feels itself to be in a threatened regional environment," says Gause. "They're also going to have to confront the domestic issues of falling oil prices, and what that means for government spending, and I think their impulse is not going to be to loosen up. I think it's going to be to tighten up."