The killings of 12 journalists and others at Charlie Hebdo in Paris has led many to wonder about the role of Islam in fueling vicious attacks on civilians in the name of the religion.

Policymakers wring their hands about how to curtail the spread of extremist religious ideologies that terrorize Western targets, but also Muslims and non-Muslim minorities in the Middle East, who are extremism's primary victims.

Where are some Muslims getting the idea that violence against journalists who offend them is OK? Why do they see beheadings as a fitting punishment?

A good place to look for answers would be to examine Saudi Arabia's policies of intolerance and extremism. King Abdullah, as the protector of Islam's most sacred religious sites and leader of Saudi Arabia, is widely considered an important role model for Muslims around the world. So it should not come as a surprise that many Muslims take their cues from the country on the prohibitions and punishments they consider appropriate to inflict on those who challenge or disagree with their interpretations of Islam.

Saudi Arabia gave a good indication of its position on appropriate punishments last Friday, when it carried out Round 1 of a public flogging -- 50 lashes -- against Raif Badawi, a young blogger, in front of the al-Jafali mosque in Jeddah. A Saudi court had fined Badawi and sentenced him in 2014 to 1,000 lashes over 20 sessions and to 10 years in prison for the crime of "insulting Islam" -- in part for setting up a liberal website to debate various topics, including religion.

Badawi is not the only Saudi who has faced punishment for his perceived views. The government has jailed many leading intellectuals, writers, and activists who have dared to question any tenet of the orthodoxy imposed by the country's Wahabi religious leaders. A former colleague of Badawi, Su`ad al-Shammari, was jailed in late 2014 on charges of "insulting the messenger and the hadith" in connection with tweets that allegedly criticized religious authorities.

In October, a Saudi court sentenced a Shiite cleric, Nimr al-Nimr, to death for criticizing the government and "breaking allegiance with the ruler." The prosecutor had sought what the Saudis call a crucifixion sentence, the kingdom's harshest, in which the convicted person is beheaded and the decapitated body displayed in public.

There is so much shock and outrage about ISIS propaganda videotapes showing its beheadings of journalists in Iraq and Syria -- and most recently, the reported beheadings of two Tunisian journalists in Libya. But the much more routine and widespread beheadings by Saudi Arabia get little scrutiny and condemnation. Saudi Arabia beheaded at least 26 people last August alone. The 82 executions in 2014 make Saudi Arabia a world leader in capital punishment.

So is it really any surprise that extremist groups -- also acting in the name of Islam -- seem to be following Saudi's lead, meting out their own severe punishments against journalists and activists they find offensive? If Saudi Arabia thinks publicly beheading people comports with Islamic religious teachings and deters those who also might want to criticize them or question their religion, why shouldn't ISIS?

One might argue that a nation, unlike some self-designated Islamic Caliphate, has the legitimacy and authority to exercise state-sponsored violence, including against its own citizens. But countries also have obligations to respect human rights. Saudi Arabia's abusive prosecutions and cruel punishments flout these obligations, and undermine its own legitimacy.

There is probably little governments and policymakers can do to influence the ideology of extremist armed groups. But there's a lot more they can and should do to influence the policies and practices of purported allies in the "war on terror." That includes the anti-ISIS coalition, to which Saudi Arabia and many other unaccountable, authoritarian, and deeply abusive Arab governments belong.

While the United States and United Kingdom governments' statements condemning Badawi's flogging were a good start, more often these countries are utterly silent in the face of Saudi Arabia's grotesque abuses against its own citizens. The West's denunciations of ISIS abuses have less credibility when governments carrying out similar abuses, if much smaller in scale and magnitude, are good chums, strong allies, and important investors.

If the international community is serious about taking on Islamist extremist ideologies -- if it wants to see real models of tolerance, respect for diverse viewpoints, religious freedom, and the free and peaceful exchange of ideas — it must urge King Abdullah to be the true protector of the rights of Muslims around the world.

For a start, he can overturn the sentence against Badawi and release dozens of detained activists and writers. He could even abolish beheadings, overnight, if that is what he wanted.

Sarah Leah Whitson is the director of the Middle East and North Africa division at Human Rights Watch. Follow on Twitter @sarahleah1